docs(rfc): propose ending a confined worker's programs with it
Problem
A confined worker leads its own session, so programs it starts share its process group. None of them end with it:
- When the worker exits, a program it left running keeps its
--directpaths, the runtime directories, the network, and the terminal. - When the broker gets
SIGINT,SIGTERM, orSIGHUP, the worker dies by its death signal, but programs it started have none and outlive both.broker_confined.rs::kernel::a_program_a_confined_worker_starts_outlives_its_brokershows this.
Change
RFC 0010 proposes that in confined mode the broker kills the worker's process group:
- When the worker exits:
waitid(WNOWAIT), thenkill(-pid, SIGKILL), then reap. The zombie keeps the ID in use, so the kill can't reach a reused ID. - On
SIGINT,SIGTERM, orSIGHUP: a thread blocked insigwaitkills the group, the main thread reaps the worker, and the broker dies by the same signal.
--unconfined is unchanged, because that worker shares the broker's group. The RFC documents the limits: programs that call setsid or setpgid, and SIGKILL to the broker. It weighs PID namespaces, cgroup.kill, a child subreaper, and signal-hook as alternatives.
This follows the maintainer's choice, among the options from the internal review, to kill the process group. The RFC asks two questions:
- Should signals go through
sigwaitin the existingsysmodule, or throughsignal-hook? - When stopped, should the broker die by the signal, or exit with 128 plus its number?
It also adds the roadmap item under M9.
Verification
Docs only. Checked against the code:
confine.rscallssetsidbefore the death signal.fsgate-broker.rs::run_inheritedreaps withChild::wait.rustix1.1.6 has safewaitidwithWaitIdOptions::NOWAITandkill_process_group, and onlyunsafesignal-mask calls.
Nothing was implemented or run.
Documentation and release
No behavior change and no changelog entry. If accepted, the implementation updates the threat model's lifetime rows, the README limit, RFC 0008's "does not stop" list, and the changelog under Changed.
Decisions
The maintainer accepted the RFC as written, and the second commit records it. Signals use sigwait in the sys module of confine.rs, with no new dependency, and a broker stopped by a signal dies by that signal. The roadmap marks the RFC item done and adds "Implement RFC 0010".