Commit 69798387 authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

ensure SIGCHLD isn't inherited as blocked

Use SIG_SETMASK instead of SIG_BLOCKMASK here in case the parent had SIGCHLD
blocked. In this case if one of the criu threads has a problem, since the
SIGCHLD is blocked, the restore simply hangs.
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Acked-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent f8d14290
...@@ -1255,7 +1255,15 @@ static int criu_signals_setup(void) ...@@ -1255,7 +1255,15 @@ static int criu_signals_setup(void)
*/ */
sigfillset(&blockmask); sigfillset(&blockmask);
sigdelset(&blockmask, SIGCHLD); sigdelset(&blockmask, SIGCHLD);
ret = sigprocmask(SIG_BLOCK, &blockmask, NULL);
/*
* Here we use SIG_SETMASK instead of SIG_BLOCK to avoid the case where
* we've been forked from a parent who had blocked SIGCHLD. If SIGCHLD
* is blocked when a task dies (e.g. if the task fails to restore
* somehow), we hang because our SIGCHLD handler is never run. Since we
* depend on SIGCHLD being unblocked, let's set the mask explicitly.
*/
ret = sigprocmask(SIG_SETMASK, &blockmask, NULL);
if (ret < 0) { if (ret < 0) {
pr_perror("Can't block signals"); pr_perror("Can't block signals");
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment