Commit bf0d4c4b authored by Pavel Emelyanov's avatar Pavel Emelyanov

sig: Block signals once before forking children

We already have a signals setup helper for this.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
parent 8c133309
......@@ -1072,6 +1072,7 @@ static int criu_signals_setup(void)
{
int ret;
struct sigaction act;
sigset_t blockmask;
ret = sigaction(SIGCHLD, NULL, &act);
if (ret < 0) {
......@@ -1102,6 +1103,19 @@ static int criu_signals_setup(void)
return -1;
}
/*
* The block mask will be restored in sigreturn.
*
* TODO: This code should be removed, when a freezer will be added.
*/
sigfillset(&blockmask);
sigdelset(&blockmask, SIGCHLD);
ret = sigprocmask(SIG_BLOCK, &blockmask, NULL);
if (ret < 0) {
pr_perror("Can't block signals");
return -1;
}
return 0;
}
......@@ -1253,7 +1267,6 @@ static int restore_task_with_children(void *_arg)
struct cr_clone_arg *ca = _arg;
pid_t pid;
int ret;
sigset_t blockmask;
current = ca->item;
......@@ -1320,19 +1333,6 @@ static int restore_task_with_children(void *_arg)
goto err;
}
/*
* The block mask will be restored in sigreturn.
*
* TODO: This code should be removed, when a freezer will be added.
*/
sigfillset(&blockmask);
sigdelset(&blockmask, SIGCHLD);
ret = sigprocmask(SIG_BLOCK, &blockmask, NULL);
if (ret) {
pr_perror("%d: Can't block signals", current->pid.virt);
goto err;
}
if (prepare_mappings(pid))
goto err;
......
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