[lxc-devel] [lxc/master] start: setsid in init task as well

tych0 on Github lxc-bot at linuxcontainers.org
Fri Feb 26 00:05:13 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 584 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160226/c41b7d30/attachment.bin>
-------------- next part --------------
From 8c9a76651a9f2106d9e8cc853b848060455858e6 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Thu, 25 Feb 2016 17:04:01 -0700
Subject: [PATCH] start: setsid in init task as well

If we don't do this, we'll leak the parent's session id to the container,
which maybe doesn't matter, but it still seems better to set it anyway.

Also, it breaks CRIU for containers that don't call setsid themselves.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 src/lxc/start.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/lxc/start.c b/src/lxc/start.c
index acf32e4..6a3ab95 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -851,6 +851,8 @@ static int do_start(void *data)
 		goto out_warn_father;
 	}
 
+	setsid();
+
 	/* after this call, we are in error because this
 	 * ops should not return as it execs */
 	handler->ops->start(handler, handler->data);


More information about the lxc-devel mailing list