[lxc-devel] [lxc/master] attach: don't shutdown ipc socket in child

smibarber on Github lxc-bot at linuxcontainers.org
Tue Sep 18 03:17:00 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 650 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180918/abc1cde7/attachment.bin>
-------------- next part --------------
From 5dc59a075516ccbcdd6333d6630d6fee578f5fe0 Mon Sep 17 00:00:00 2001
From: Stephen Barber <smbarber at chromium.org>
Date: Mon, 17 Sep 2018 17:31:22 -0700
Subject: [PATCH] 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 <smbarber at chromium.org>
---
 src/lxc/attach.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/lxc/attach.c b/src/lxc/attach.c
index 425f257e4..ffae98539 100644
--- a/src/lxc/attach.c
+++ b/src/lxc/attach.c
@@ -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);


More information about the lxc-devel mailing list