]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
attach: don't shutdown ipc socket in child 2619/head
authorStephen Barber <smbarber@chromium.org>
Tue, 18 Sep 2018 00:31:22 +0000 (17:31 -0700)
committerStephen Barber <smbarber@chromium.org>
Tue, 18 Sep 2018 03:07:43 +0000 (20:07 -0700)
shutdown() affects sockets even across forked processes. The
attached child process doesn't have any interest in using the
IPC socket, so just close it in the child process and let the
intermediate process handle shutting it down.

This fixes a bug seen with lxc exec in crbug.com/884244

Signed-off-by: Stephen Barber <smbarber@chromium.org>
src/lxc/attach.c

index 425f257e4239f1c0b7f7fe8ffc4843626e26100c..ffae98539181e49b58643b61e649a2e045664290 100644 (file)
@@ -728,7 +728,6 @@ struct attach_clone_payload {
 static void lxc_put_attach_clone_payload(struct attach_clone_payload *p)
 {
        if (p->ipc_socket >= 0) {
-               shutdown(p->ipc_socket, SHUT_RDWR);
                close(p->ipc_socket);
                p->ipc_socket = -EBADF;
        }
@@ -906,7 +905,6 @@ static int attach_child_main(struct attach_clone_payload *payload)
                TRACE("Loaded seccomp profile");
        }
 
-       shutdown(payload->ipc_socket, SHUT_RDWR);
        close(payload->ipc_socket);
        payload->ipc_socket = -EBADF;
        lxc_proc_put_context_info(init_ctx);