[01/28] pid_ns: Set sid for root_item

Submitted by Kirill Tkhai on June 5, 2017, 5:23 p.m.

Details

Message ID 149668341354.25229.9953798028903724013.stgit@localhost.localdomain
State New
Series "Support sockets leaked to child user_ns task"
Headers show

Commit Message

Kirill Tkhai June 5, 2017, 5:23 p.m.
Temporary functionality until complete setsid() support
is implemented. This is need to make tests with "--iter"
working in jenkins.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/cr-restore.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 7c449af47..a609a1ed9 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1505,8 +1505,11 @@  static void restore_sid(void)
 {
 	pid_t sid;
 
-	if (!list_empty(&top_pid_ns->children))
+	if (!list_empty(&top_pid_ns->children)) {
+		if (current == root_item)
+			setsid();
 		return;
+	}
 	/*
 	 * SID can only be reset to pid or inherited from parent.
 	 * Thus we restore it right here to let our kids inherit