944. The self-test proves a supervised death and a teardown that leaks nothing
(Title and slug provisional.)
Reuse: the TCB spawn path (create_thread_control_block, CAP_INSERT, CONFIGURE, START) and
the supervision fixtures system_tests already had, moved into the kernel so both use one copy.
user::run was the proposal's candidate and is not used: supervision is fixed at START from the
reserved fault slot and never afterward (DECISIONS ยง26 (the fault endpoint)), and a thread run
enters never passes START. Nothing new is taken.
Raised 2026-10-20 (UTC) by lane milestone/890-tours-to-self-test. calef ruled on 2026-10-19
(UTC), on #2434, that every claim the per-port tours made becomes a check in self_test::run.
Two of x86_64's did not, and milestone 890 (riscv64 and x86_64 join the shared boot path)
recorded them in its BUGS.
Index row
Two of the per-port tours' claims are checks in the boot self-test on all three ports: a faulting thread's death reaches its supervisor, and tearing a process down returns every frame. Both spawn through one helper that takes a supervision endpoint.
The two claims
- A faulting user-level thread's death reaches its supervisor as a message, naming the thread, the faulting pc and the address.
- Tearing down a process returns every frame it cost. A teardown measured once, before a spawn and after its teardown, also counts first-use carves and whatever else allocated in the window, so the claim is about a second round.
What was built
kernel/src/user/supervised_child.rs(name provisional):spawn(region, stub, capabilities, fault)builds a child's address space, code page, stack page and TCB out of one untyped region, putscapabilitiesin slots 0, 1, ... andfaultinabi::fault::FAULT_EP_SLOT, and starts it. It refuses by naming the step rather than panicking. Beside it are the fault and report stubs for aarch64, riscv64 andx86_64(x86_64's fromuser::x86_programs),code_page,supervision_endpointand the addresses.CODE_VAandSTACK_VAare spelled out asCODE_ADDRESSandSTACK_ADDRESSthere; the suite imports the first under its old name.system_tests'supervision_testsandcode_pagesuse that module, so the suite and the boot build the same child.self_test::rungains two checks afterbudget, andboot_ladder::SELF_TEST_CHECKSlists them.SELF_TEST_CHECKS_EARLIERgains 13, so a log from a 13-check kernel still reads green.supervised: one child, born supervised, faults on a load from an unmapped address. The message must beEVENT_FAULTwith the child's thread id, the load's pc and the address; the corpse is then reaped with its region.teardown: the same round twice, judged on the second: the used-frame count must not move.
budgetwaits for its helper thread's reap, so no teardown is in flight whenteardownbrackets the count.
notes/self-test-checks.md has each check's design.
Evidence
script/boot-check, all three under QEMU, 2026-10-24 (UTC):
| port | supervised |
teardown (first, second round) |
verdict |
|---|---|---|---|
| aarch64 | pc 0x60000004, addr 0xa50000 |
0, 0 frames | 10 of 15 passed, 5 absent |
| riscv64 | pc 0x60000004, addr 0xa50000 |
0, 0 frames | 10 of 15 passed, 5 absent |
x86_64 |
pc 0x60000005, addr 0xa50000 |
0, 0 frames | 12 of 15 passed, 3 absent |
Falsification: one frame allocated and dropped after the second round turns the aarch64 verdict
red, teardown FAILED ... the first cost 0 frame(s), the second 1. script/test on all three
runs the suite's supervision tests through the shared helper; the pull request has the gate table.
Done when
- A spawn helper takes a supervision endpoint on aarch64, riscv64 and
x86_64. self_test::runhassupervisedandteardown, and both pass under QEMU on all three.- Milestone 890's BUGS line and follow-on bullet point here.
Exit criteria, as built
| criterion | state |
|---|---|
| 1 | Done: user::supervised_child::spawn, one function on all three. |
| 2 | Done: the table above. |
| 3 | Done. |
BUGS
teardown, likebudget, brackets the machine's used-frame count, so it is sound only while nothing else on any core allocates or frees in its window. Each earlier check waits for its own reaps; nothing enforces that a later-added check does.- Neither check has run on a board yet. Both name claims that hold on every machine, so neither is ever absent, and the next radon or xenon boot reads them.
- The stubs are hand-assembled per port; a wrong encoding shows only as a fault at an unexpected
pc, which
supervisedasserts.
Follow-on
- Recorded. The frame-count bracket's soundness is a BUGS entry in
kernel/src/self_test.rs. - Recorded. The first board boot that reads both checks is the next radon or xenon session's, in this block's BUGS.