Index: sandbox/linux/suid/sandbox.c |
diff --git a/sandbox/linux/suid/sandbox.c b/sandbox/linux/suid/sandbox.c |
index 2dd78ef1eefbc8e68f8326e6bbb54b0dbfeb9195..f6e6c495d9d3557857268c555b32bd550074dfe7 100644 |
--- a/sandbox/linux/suid/sandbox.c |
+++ b/sandbox/linux/suid/sandbox.c |
@@ -58,6 +58,15 @@ static void FatalError(const char *msg, ...) { |
_exit(1); |
} |
+static void ExitWithErrorSignalHandler(int signal) { |
+ const char msg[] = "\nThe setuid sandbox got signaled, exiting.\n"; |
+ if (-1 == write(2, msg, sizeof(msg) - 1)) { |
+ // Do nothing. |
+ } |
+ |
+ _exit(1); |
+} |
+ |
// We will chroot() to the helper's /proc/self directory. Anything there will |
// not exist anymore if we make sure to wait() for the helper. |
// |
@@ -195,6 +204,15 @@ static void WaitForChildAndExit(pid_t child_pid) { |
int exit_code = -1; |
siginfo_t reaped_child_info; |
+ // Don't "Core" on SIGABRT. SIGABRT is sent by the Chrome OS session manager |
+ // when things are hanging. |
+ // Here, the current process is going to waitid() and _exit(), so there is no |
+ // point in generating a crash report. The child process is the one |
+ // blocking us. |
+ if (signal(SIGABRT, ExitWithErrorSignalHandler) == SIG_ERR) { |
+ FatalError("Failed to change signal handler"); |
+ } |
+ |
int wait_ret = |
HANDLE_EINTR(waitid(P_PID, child_pid, &reaped_child_info, WEXITED)); |