Unverified Commit 8cf8e2e3 by Stephen Barber Committed by Christian Brauner

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: 's avatarStephen Barber <smbarber@chromium.org>
parent 97dd9582
...@@ -728,7 +728,6 @@ struct attach_clone_payload { ...@@ -728,7 +728,6 @@ struct attach_clone_payload {
static void lxc_put_attach_clone_payload(struct attach_clone_payload *p) static void lxc_put_attach_clone_payload(struct attach_clone_payload *p)
{ {
if (p->ipc_socket >= 0) { if (p->ipc_socket >= 0) {
shutdown(p->ipc_socket, SHUT_RDWR);
close(p->ipc_socket); close(p->ipc_socket);
p->ipc_socket = -EBADF; p->ipc_socket = -EBADF;
} }
...@@ -906,7 +905,6 @@ static int attach_child_main(struct attach_clone_payload *payload) ...@@ -906,7 +905,6 @@ static int attach_child_main(struct attach_clone_payload *payload)
TRACE("Loaded seccomp profile"); TRACE("Loaded seccomp profile");
} }
shutdown(payload->ipc_socket, SHUT_RDWR);
close(payload->ipc_socket); close(payload->ipc_socket);
payload->ipc_socket = -EBADF; payload->ipc_socket = -EBADF;
lxc_proc_put_context_info(init_ctx); lxc_proc_put_context_info(init_ctx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment