summaryrefslogtreecommitdiffstats
path: root/sandbox
diff options
context:
space:
mode:
authorjln@chromium.org <jln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-15 00:41:31 +0000
committerjln@chromium.org <jln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-15 00:41:31 +0000
commit6aece5e3e77e216aaaefb508cf3b44ed9c9d7808 (patch)
tree06c127cb1f9dd6754cd77fdf010b6cf2d9558c4d /sandbox
parenta91b574d029d385afd93652e0fb34b48271eb702 (diff)
downloadchromium_src-6aece5e3e77e216aaaefb508cf3b44ed9c9d7808.zip
chromium_src-6aece5e3e77e216aaaefb508cf3b44ed9c9d7808.tar.gz
chromium_src-6aece5e3e77e216aaaefb508cf3b44ed9c9d7808.tar.bz2
Setuid sandbox: exit(2) on SIGABRT
The setuid sandbox waits on its one child and then dies afterwards. When receiving SIGABRT, instead of dumping core, simply exit the process. There is no interesting information to be gathered from knowing that the process is inside waitid(2), one should look at the child process instead. This patch is in hope to reduce red herrings. BUG=334345 TBR=jorgelo NOTRY=true Review URL: https://codereview.chromium.org/167583002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251459 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/linux/suid/sandbox.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sandbox/linux/suid/sandbox.c b/sandbox/linux/suid/sandbox.c
index 2dd78ef..f6e6c49 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));