sandbox: unblock signal before calling execv()
The following faulty behavior was observed. The sandbox configured with CONFIG_SANDBOX_CRASH_RESET=y was invoked with ./u-boot -T -S After executing `exception undefined' the sandbox reboots. When executing `exception undefined' the sandbox exits with SIGSEGV. The expected behavior is that the sandbox should reboot again. 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. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
81da5042e5
commit
a2a9317cbc
1 changed files with 16 additions and 0 deletions
|
@ -1017,8 +1017,24 @@ void *os_find_text_base(void)
|
||||||
return base;
|
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[])
|
void os_relaunch(char *argv[])
|
||||||
{
|
{
|
||||||
|
os_unblock_signals();
|
||||||
|
|
||||||
execv(argv[0], argv);
|
execv(argv[0], argv);
|
||||||
os_exit(1);
|
os_exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue