[CRIU] [PATCH v3 00/55] Nested pid namespaces support

Kirill Tkhai ktkhai at virtuozzo.com
Tue Apr 11 05:10:27 PDT 2017


On 11.04.2017 07:26, Andrei Vagin wrote:
> [root at fc24 criu]# python test/zdtm.py run -t zdtm/static/pidns00 --iter 1
> Checking feature ns_pid
> === Run 1/1 ================ zdtm/static/pidns00
> 
> ======================== Run zdtm/static/pidns00 in ns =========================
> make[1]: Nothing to be done for 'default'.
> Start test
> Test is SUID
> make[1]: Nothing to be done for 'default'.
> ./pidns00 --pidfile=pidns00.pid --outfile=pidns00.out
> Run criu dump
> Run criu restore
> ################ Test zdtm/static/pidns00 FAIL at CRIU restore #################
> ##################################### FAIL #####################################
> [root at fc24 criu]# dmesg -c
> [439441.751893] traps: pidns00[27458] general protection ip:7f9b3183d642 sp:7ffc2d9587c0 error:0
> [439441.751900]  in libc.so.6[7f9b31806000+1bd000]
> [439441.768416] systemd-journald[13102]: Successfully sent stream file descriptor to service manager.
> [439441.886503] systemd-journald[13102]: Compressed data object 1176 -> 652 using LZ4
> [439441.887834] systemd-journald[13102]: Compressed data object 1658 -> 653 using LZ4
> [439441.889093] systemd-journald[13102]: Compressed data object 3128 -> 1774 using LZ4
> [439442.037519] criu[27482]: segfault at 12 ip 000000000047e4d3 sp 00007ffc190820a8 error 4 in criu[400000+117000]
> [439442.058973] systemd-journald[13102]: Successfully sent stream file descriptor to service manager.
> [439442.211795] systemd-journald[13102]: Compressed data object 1150 -> 665 using LZ4
> [439442.213101] systemd-journald[13102]: Compressed data object 5493 -> 1619 using LZ4
> [root at fc24 criu]# 
> [root at fc24 criu]# git diff
> diff --git a/test/zdtm/static/pidns00.c b/test/zdtm/static/pidns00.c
> index e3ed74b..e86d488 100644
> --- a/test/zdtm/static/pidns00.c
> +++ b/test/zdtm/static/pidns00.c
> @@ -54,6 +54,11 @@ futex_t *futex;
>  
>  int child(void)
>  {
> +       int fd = open("/proc/self/ns/pid", O_RDONLY);
> +       unshare(CLONE_NEWPID);
> +       if (fork())
> +               setns(fd, CLONE_NEWPID);
> +       close(fd);
>         futex_wait_while_lt(futex, 1);
>         return 0;
>  }

The below fixes the issue. Thanks for finding this!

diff --git a/criu/pstree.c b/criu/pstree.c
index b2703dd01..d032957ae 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -844,7 +844,7 @@ int get_free_pid(struct ns_id *ns)
 		node = rb_next(&prev->ns[level].node);
 		if (node == NULL)
 			return pid;
-		next = rb_entry(node, struct pid, ns[0].node);
+		next = rb_entry(node, struct pid, ns[level].node);
 		if (next->ns[level].virt > pid)
 			return pid;
 		prev = next;



More information about the CRIU mailing list