A supervisor never execs
The Linux trampoline is a supervisor, so it never becomes anything: it
spawns the program, or forks the bundled tool, waits, and reports. A process
that execs has no later, and the report’s last record, ended, is written
after the program’s end. The code is
core/src/authority/sandbox/warrant/trampoline.rs (Confined::run, one per
platform; start_file, start_tool and supervise). This page is the one home
of the supervisor and of the SIGSEGV example below.
- Before the spawn,
outlive_group_signalsgives each ofSIGINT,SIGTERM,SIGHUPandSIGQUITa no-op handler, so the supervisor survives a signal sent to the payload’s whole group and can still report. A signal that was inherited as ignored (SIG_IGN) is kept ignored: the program inherits the user’s choice, not ral’s. A caught disposition resets to the default at the program’sexecve. - The program dies with its supervisor. The spawned program’s pre-exec, and
the forked tool child, each set
PR_SET_PDEATHSIG(SIGKILL)and then checkgetppidagainst the supervisor’s pid (die_with): a supervisor already gone before theprctlleaves no death signal to hear, and the check turns that into a failure instead of an orphan. The failure is ral’s own: the child tells it on a close-on-exec pipe, and the supervisor reportsrefused, neverunstarted, which is the file’sexecvealone (the report’s records). - The supervisor itself sets no death signal. Its life is tied to ral’s by
the envelope: a launch the session keeps passes bwrap
--die-with-parent(with--info-fd), so the envelope, and the supervisor inside it, ends when ral does. A surrendered (detach) launch carries neither, deliberately: the survivor must outlive ral. The supervisor outlives every signal sent to the payload’s group butSIGKILL. SIGPIPEis ignored before the supervisor writes, so a vanished reader (a detached launch whose parent is gone) is a failed write, never a death. A write that fails finds nobody to tell and is dropped. The report’s end is typed to match:Witness::startedyields aRunning, whoseendedis the only way to writeended, so no path says an end before a start.- It reports the exact wait status,
ended, and exits with the program’s code, or128 + nfor a death by signaln. A confinedSIGSEGVis thereforesignaled 11and anexit 139isexited 139. - A bundled tool is forked, not run in-process. A tool may itself
execve(env), which would close the report untold. The forked tool child begins as a spawned program does: it resets the caught dispositions to their defaults, clears the signal mask, setsPDEATHSIG, and has closed its copy of the report (tool_child); the tool’s own entry,uutils::serve, restoresSIGPIPE. It is silent, and tells the supervisor whether it began, one word on a close-on-exec pipe, before it runs the tool: the supervisor saysstartedonly after that word, and a child that cannot begin isrefusedwith its errno, never a tool thatexited 126. Having spoken, it closes its end of the pipe: close-on-exec fires only at anexecve, which a forked tool never makes, so the tool holds stdio and nothing else, as a spawned program does. It never returns into the supervisor’s frames, by a panic either. - The trampoline is single-threaded up to that fork. Its warrant role starts
no thread, so the forked child may run anything. Landlock’s
restrict_selfis called withoutTSYNCand so binds only the calling thread; it confines the whole process only because no second thread exists.
Why. Under the envelope, bwrap folds the payload’s death into an exit
status, 128 + n for a signal, which cannot tell signaled 11 from exit 139.
Only a process that waits for the program can say what happened to it, and it
can say so only if it outlives the program, outlives the group’s signals, and
cannot be inherited by it. macOS keeps execve in place: there the program
keeps the trampoline’s pid and its wait status is exact. The choice is
the-trampoline-is-a-supervisor.
See confined-launch, linux-envelope and the-ending-is-amended-where-it-is-reaped.