Skip to content

Commit

Permalink
attach: don't shutdown ipc socket in child
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Barber authored and Christian Brauner committed Dec 10, 2018
1 parent 0c0f005 commit 4523e21
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/lxc/attach.c
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4523e21

Please sign in to comment.