Phase B.2: shrinking what a broken progenitor can do
Name: provisional.
An appendix to notes/trusted-init.md, which summarizes it.
B.1 settled what bytes the progenitor is. B.2 is the other half: what a compromised progenitor can still reach.
The pre-B.2 progenitor (system_initializer, hello's init role) holds a large untyped budget for its entire life,
because it stays the system's process builder. Every process in the system is therefore one bug in
the progenitor away from being built wrong. The answer is not to make the progenitor more careful; it is to make it
hold less, and to make it hold it for less time.
The tree
Four small portable programs (components/src/root_supervisor.rs, spawner.rs,
sub_server_supervisor.rs, first_attempt_crasher.rs, sharing crates/supervision_contract):
root_supervisor the root untyped + the initrd + a report endpoint (briefly)
|
+-- spawner one program image, one budget (WRITE), no initrd (can build only that program)
|
+-- sub_server_supervisor a request channel + a fault endpoint, NO memory (cannot build anything)
|
+-- first_attempt_crasher a report endpoint (the supervised sub-server)
then: root_supervisor deletes its untyped and becomes a RECEIVE loop on its own supervision endpoint.
Each split is chosen so that the authority is the smallest thing that still does the job:
- The spawner holds a program image, not the initrd. root_supervisor copies
first_attempt_crasher's bytes into fresh read-only pages in the spawner's address space (theblobsfield ofEndow). So "build me program X" is not a request the spawner can honor for any other X: the only program it can name is the one it was handed. Compare the progenitor, which holds a 14 MB archive of every program in the system. - The spawner's budget is WRITE without GRANT. It may spend memory; it may not lend it. Nothing it builds can be endowed with a budget of its own.
- Each instance is built in its own region, split off the budget, so reaping it is one
MemoryRegion::DESTROY(§16 (object revocation)) and one instance's corpse cannot pin another's memory. A LIFO reap returns the pages to the budget (§16's return-of-pages), so the restart loop is not a leak. - The supervisor holds no memory at all. Its entire power is to ask the spawner for a rebuild of one program. A compromised supervisor is a restart loop, not a foothold.
- root_supervisor deletes the budget once the two servers are running (and the wiring capabilities, and the spawner's budget copy). What is left cannot make a page, an address space, a thread, or an endpoint.
Restart policy is userspace code, and stays there
sub_server_supervisor is the policy: bounded retries (two), a clean exit read as "finished" rather than "crashed",
a give-up when the budget runs out. It reaps the corpse through the spawner before rebuilding, because
§26's corpse is dead-until-reaped. None of that is in the kernel, and the kernel's whole contribution
is one five-word message. That is DECISIONS §26 working as designed: the kernel is the only witness to
a death, so it reports; everything after the report is somebody's opinion.
Note which side of the split reaping falls on: the supervisor decides whether to reap and rebuild, the spawner is what can. Policy and authority, separated by an IPC boundary.
What is proven, both ISAs
system_tests/src/user/authority_tests.rs:
the_root_supervisor_drops_its_construction_authority_and_cannot_build_again. After the handoff, root_supervisor tries the two primitives that build things (retype a page, retype a kernel object). It reports the result from inside the process, because what matters is what the holder can do and only the holder can ask. Both fail, and they fail withNoSuchSlot(there is nothing there), notNotPermitted(there is something there and you may not use it). That distinction is the whole difference between "we asked the progenitor not to" and "the progenitor cannot".a_dead_sub_server_is_restarted_by_its_supervisor_not_by_the_root. The sub-server runs as attempt 0 and faults on a load from an unmapped address. The supervisor receivesFAULT, reaps the corpse through the spawner, and asks for attempt 1. Attempt 1 runs and exits cleanly. The supervisor receivesEXITand does not restart it. Exactly five reports arrive and the endpoint then has no parked sender, which is how "and then nothing else happened" is asserted without a blocking receive.
"Without the progenitor's involvement" is an authority argument, not a timing one. The progenitor cannot retype a page by then, and a process that cannot retype a page cannot have built the replacement. Scheduling order is not the evidence; the empty capability slot is.
The bug this work found
The supervision-tree tests enter more processes per run than anything before them. That surfaced a
pre-existing race in the exception-return path on both architectures. Staging SPSR_EL1/ELR_EL1
(and sepc/sstatus) for the eret is not atomic with respect to a nested exception. So an
interrupt in a two-instruction window could return a brand-new process to its entry point at EL1. Fixed by
masking interrupts at the top of the restore. Full account in notes/exceptions.md; it is written up
there rather than here because it is an exception-path fact, not a progenitor fact.
Two design forks found and deliberately not built through
- Reaping requires the same right as building.
MemoryRegion::DESTROYneedsWRITEon the region, and so doesRETYPE. So a root supervisor that could restart a dead tier-one server is a root supervisor that can build processes, which is exactly the authority we set out to give away. root_supervisor therefore chooses to be unable to build, and its policy for a dead tier-one server is "report and stop", the fail-closed floor pushed as high and as small as it goes. Splitting a reap-only right out ofWRITE(a rights bit, or a distinctUntyped::REAP) would let a root supervisor recover without regaining construction authority. That is a kernel surface change and a rights-model change, so it is an architect's call, not a thing to slip in. - A supervisor cannot turn a tid into a handle. The death message names the dead thread by tid
(§26 (the fault endpoint), item 5), and nothing turned a tid into something a builder holds.
The options were
Tcb::NAME, per-child fault endpoints, or the builder reporting the tid.
Both are answered. Fork one by §32 (a supervisor may collect a corpse without being able to build
one) and §148 (a supervisor restarts by asking)'s spawner pattern. Fork two by §148 as amended
2026-10-04: the death message carries the builder's label, and sub_server_supervisor tells two
children apart by it. See milestone 105 (the two forks).
The spawner and the supervisor as they stand
components/src/spawner.rs builds; components/src/sub_server_supervisor.rs decides. What each
holds, and what it gives up, follows from §32 (a supervisor may collect a corpse without being able
to build one) and §148 as amended 2026-10-04.
- The spawner does not keep an instance's region capability. Reaping is a method on the supervision endpoint (§32), so the capability had no remaining purpose, and the spawner deletes it as soon as the child starts. Nothing in the tree holds a capability to a live instance's memory, and the pages still return to the spawner's budget when the supervisor collects the corpse.
- That costs nothing today. A hung instance, one that livelocks and never dies, is unreclaimable either way, because a reap only follows a death message. §32 records that case as the watchdog case and leaves it open.
- The supervisor reaps its own children on the endpoint it already holds, and the pages go to the spawner's budget, because the spawner owns the region (§13 (capability revocation and untyped reclamation)). It can free its children's memory and cannot spend it. The kernel stamps the dead thread's tid on the death message, and §32 authorizes that tid relative to the endpoint it arrived on, so the spawner issues no instance handle.
- The supervisor tells its two children apart by label. A tid says which thread died, not which of
its children it was. The spawner stamps each child's supervision capability with a label the
supervisor chose (
SUB_SERVER_LABELS), and the kernel hands the label back beside the death message. The restart policy is per label, and the label comes from the kernel, never from the child it names. - The supervisor reaps before it decides anything, because a corpse is dead until reaped and its region stays pinned until then. A finished child is reaped as surely as a crashed one.
- A
StillAliverefusal of that reap cannot happen, since the tid came on a death message. It is reported as a failure anyway, because it would mean the kernel said a thread was dead and then said otherwise. - When every child is done the supervisor parks instead of exiting. Exiting would make it a death its own supervisor has to handle.
- The progenitor takes no part. By the time the first death arrives,
root_supervisorhas deleted the construction budget it would need.