Add new termination status for failed child process launch.
[chromium-blink-merge.git] / docs / seccomp_sandbox_crash_dumping.md
blob0c776fecf7f968816f3b45a875aea0c5fe40a6bb
1 # seccomp Sandbox Crash Dumping
3 Currently, Breakpad relies on facilities that are disallowed inside the Linux
4 seccomp sandbox.  Specifically, it sets a signal handler to catch faults
5 (currently disallowed), forks a new process, and uses ptrace() (also disallowed)
6 to read the memory of the faulted process.
8 ## Options
10 There are three ways we could do crash dumping of seccomp-sandboxed processes:
12 *   Find a way to permit signal handling safely inside the sandbox (see below).
13 *   Allow the kernel's core dumper to kick in and write a core file.
14     *   This seems risky because this code tends not to be well-tested.
15     *   This will not work if the process is chrooted, so it would not work if
16         the seccomp sandbox is stacked with the SUID sandbox.
17 *   Have an unsandboxed helper process which `ptrace()`s the sandboxed process
18     to catch faults.
20 ## Signal handling in the seccomp sandbox
22 In case a trusted thread faults with a SIGSEGV, we must make sure that an
23 untrusted thread cannot register a signal handler that will run in the context
24 of the trusted thread.
26 Here are some mechanisms that could make this safe:
28 *   `sigaltstack()` is per-thread. If we opt not to set a signal stack for
29     trusted threads, and set %esp/%rsp to an invalid address, trusted threads
30     will die safely if they fault.
31     *   This means the trusted thread cannot set a signal stack on behalf of the
32         untrusted thread once the latter has switched to seccomp mode. The
33         signal stack would have to be set up when the thread is created and not
34         subsequently changed.
35 *   `clone()` has a `CLONE_SIGHAND` flag. By omitting this flag, trusted and
36     untrusted threads can have different sets of signal handlers. This means we
37     can opt not to set signal handlers for trusted threads.
38     *   Again, per-thread signal handler sets would mean the trusted thread
39         cannot change signal handlers on behalf of untrusted threads.
40 *   `sigprocmask()/pthread_sigmask()`: These can be used to block signal
41     handling in trusted threads.
43 ## See also
45 *   [LinuxCrashDumping](linux_crash_dumping.md)
46 *   [Issue 37728](https://crbug.com/37728)