[CRIU] [PATCH] criu: allow the root task to handle SIGCHLD

Andrey Vagin avagin at openvz.org
Thu Aug 14 05:52:02 PDT 2014


The criu process attaches to the root task, if opts.swrk_restore
opts.restore_detach is set. In this case ptrace will ask permissions to
handle signals.

This patch fixes the following error of static/zombie00:

Execute zdtm/live/static/zombie00
./zombie00 --pidfile=zombie00.pid --outfile=zombie00.out
Dump 2207
Restore
Test: zdtm/live/static/zombie00, Result: FAIL
==================================== ERROR ====================================
Restore log: /root/git/orig/criu/test/dump/static/zombie00/2207/1/restore.log
(00.026826) Error (cr-restore.c:1085): 2207 killed by signal 17
(00.026985) Error (cr-restore.c:1706): Restoring FAILED.
================================= ERROR OVER =================================

Reported-by: Mr Jenkins
Cc: Pavel Emelyanov <xemul at parallels.com>
Cc: Tycho Andersen <tycho.andersen at canonical.com>
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 cr-restore.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/cr-restore.c b/cr-restore.c
index bd16b1d..4def1bd 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1055,6 +1055,13 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
 		status = exit ? WEXITSTATUS(status) : WTERMSIG(status);
 	}
 
+	if (!current && siginfo->si_code == CLD_TRAPPED &&
+				siginfo->si_status == SIGCHLD) {
+		/* The root task is ptraced. Allow it to handle SIGCHLD */
+		ptrace(PTRACE_CONT, siginfo->si_pid, 0, SIGCHLD);
+		return;
+	}
+
 	if (!current || status)
 		goto err;
 
-- 
1.9.3



More information about the CRIU mailing list