From: Stephen Barber Date: Tue, 18 Sep 2018 00:31:22 +0000 (-0700) Subject: attach: don't shutdown ipc socket in child X-Git-Tag: lxc-2.0.10~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4523e218410946cead3fbad1de225fc14caf1e09;p=thirdparty%2Flxc.git attach: don't shutdown ipc socket in child 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 --- diff --git a/src/lxc/attach.c b/src/lxc/attach.c index c4330895b..9d36bfa1d 100644 --- a/src/lxc/attach.c +++ b/src/lxc/attach.c @@ -706,7 +706,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; } @@ -848,7 +847,6 @@ static int attach_child_main(struct attach_clone_payload *payload) goto on_error; 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);