fix(broker): end a confined worker's programs when the broker gets SIGQUIT
Merged
KI
22d ago+40+40+01234567890123456789-13-13-01234567890123456789
Problem
Ctrl-\ sends SIGQUIT to the broker. The broker did not handle it, so it died without killing its confined worker's process group (RFC 0010). The worker got its death signal, but programs it started kept running, still confined, with the network, their --direct paths, delivered files, and the terminal. The worker leads its own session, so Ctrl-\ reaches only the broker. RFC 0010 lists only SIGKILL as a signal that skips the kill.
Found in an internal review.
Change
STOP_SIGNALSinconfine.rsaddsSIGQUITtoSIGINT,SIGTERM, andSIGHUP. The broker kills the group, then dies bySIGQUITas it would have.stopping_the_broker_ends_a_confined_worker_and_its_programssendsSIGQUITtoo. It turns off the broker's core dumps withprlimitfirst, so a test run leaves no core file.- A signal that only
killsends and the broker does not handle, such asSIGUSR1, is documented withSIGKILLas not covered. Someone who can send it can sendSIGKILLtoo. - Docs: RFC 0010 gets a "Changes after release" entry and a sentence under what it does not stop. RFC 0008, the threat model, and the README now name
SIGQUIT, and there is a changelog entry.
Verification
- The test went up first, without the fix (run 43525788319 on
f9b421d). It failed on the runner's kernel incheckand on Linux 6.12 and 7.3 inkernels, withthe worker or its program outlived a stopped brokeron theSIGQUITpass.SIGTERM,SIGINT, andSIGHUPpassed before it, andprlimitsucceeded. The fix is the second commit,eb2feda. - Locally on macOS (no Linux here):
cargo fmt --all --check;cargo +1.100.0 clippy --locked --all-targets -- -D warningsis clean forx86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu, and macOS;cargo +1.85.0 check --locked --all-targets --target x86_64-unknown-linux-gnupassed;cargo test --locked121 passed, 0 failed.
Not verified locally: any Linux run. That is this PR's CI on the fix commit.
Documentation and release
RFC 0008, RFC 0010, the threat model, the README, and the changelog. No version change.