[CRIU] [PATCH] Action scripts should be invoked with normal signal behavior
Nicolas Viennot
Nicolas.Viennot at twosigma.com
Thu Oct 24 22:39:39 MSK 2019
Signal masks propagate through execve, so we need to clear them before
invoking the action scripts as it may want to handle SIGCHLD, or SIGSEGV.
Signed-off-by: Nicolas Viennot <nicolas.viennot at twosigma.com>
---
criu/util.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/criu/util.c b/criu/util.c
index 0761ec04..9c0653ed 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -558,7 +558,7 @@ int cr_system_userns(int in, int out, int err, char *cmd,
sigemptyset(&blockmask);
sigaddset(&blockmask, SIGCHLD);
if (sigprocmask(SIG_BLOCK, &blockmask, &oldmask) == -1) {
- pr_perror("Can not set mask of blocked signals");
+ pr_perror("Cannot set mask of blocked signals");
return -1;
}
@@ -567,6 +567,12 @@ int cr_system_userns(int in, int out, int err, char *cmd,
pr_perror("fork() failed");
goto out;
} else if (pid == 0) {
+ sigemptyset(&blockmask);
+ if (sigprocmask(SIG_SETMASK, &blockmask, NULL) == -1) {
+ pr_perror("Cannot clear blocked signals");
+ goto out_chld;
+ }
+
if (userns_pid > 0) {
if (switch_ns(userns_pid, &user_ns_desc, NULL))
goto out_chld;
--
2.19.1
More information about the CRIU
mailing list