aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/sandbox/cpu/os.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 01845e3..d6170ad 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -1017,8 +1017,24 @@ void *os_find_text_base(void)
return base;
}
+/**
+ * os_unblock_signals() - unblock all signals
+ *
+ * If we are relaunching the sandbox in a signal handler, we have to unblock
+ * the respective signal before calling execv(). See signal(7) man-page.
+ */
+static void os_unblock_signals(void)
+{
+ sigset_t sigs;
+
+ sigfillset(&sigs);
+ sigprocmask(SIG_UNBLOCK, &sigs, NULL);
+}
+
void os_relaunch(char *argv[])
{
+ os_unblock_signals();
+
execv(argv[0], argv);
os_exit(1);
}