[CRIU] [PATCH v2 56/57] pstree: Use CLONE_NEWPID only to create child reaper of pid_ns

Kirill Tkhai ktkhai at virtuozzo.com
Tue Mar 28 08:42:20 PDT 2017


If task has no INIT_PID, then clear this clone flag.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/pstree.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/criu/pstree.c b/criu/pstree.c
index 19e8acdc..09a7ac8c 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -1109,6 +1109,8 @@ static int prepare_pstree_kobj_ids(void)
 		 * move_in_cgroup(), so drop this flag here as well.
 		 */
 		rsti(item)->clone_flags &= ~(CLONE_NEWNET | CLONE_NEWCGROUP);
+		if (last_level_pid(item->pid) != INIT_PID)
+			rsti(item)->clone_flags &= ~CLONE_NEWPID;
 
 		cflags &= CLONE_ALLNS;
 



More information about the CRIU mailing list