752. A seeded system call driver with a shadow model
Part (b) of the proposal fuzz-the-surface-a-confined-process-can-reach (#1592), ruled yes by calef
on 2026-10-04 (UTC). The number 752 is provisional (749 to 751 are held by open pull requests) and
the integrator mints it at merge. The proposal file still holds part (a); moving (b) out of it is
the integrator's once #1592 lands. (Title and slug are drafts.)
What is built
system_tests/src/user/system_call_fuzzer_tests.rs, one test,
seeded_system_calls_agree_with_the_shadow_model. From a seed, seven kernel threads issue random
capability operations through system_call::invoke, the function the trap handler calls for
SYS_INVOKE. The conductor predicts every answer, every wake, where every parked thread is parked,
and every slot of every capability table, and fails on the first difference with the seed, the step,
the call and a one-line replay. The seventh thread is the witness: it holds nothing, everything it
tries must be NoSuchSlot, and its table must stay empty.
Reached: two rendezvous, one notification, two frames and the Replies CALL mints; SEND,
RECEIVE, SEND_CAP, RECEIVE_CAP, CALL, BADGE, REPLY, SIGNAL, WAIT, POLL, BIND
(refusals only), PageFrame::REVOKE, an unknown method on each, and SYS_CAP_DELETE. Slots
include empty and out-of-range ones, rights are random subsets, and both arrival orders happen at
every rendezvous. The rest is in the module's BUGS.
Kernel threads, not an EL0 program. The proposal said EL0. The oracle needs to know which side of a rendezvous parked first, which only the kernel can say without guessing at timing, and an EL0 helper needs a TCB and an address space each. What is not exercised is the trap entry's register marshaling, which every EL0 test already crosses. At equal cost the choice would be the same, because the ordering knowledge is what makes the oracle exact.
Names are provisional: the module, the test, and NIFE_SYSTEM_CALL_FUZZ_SEEDS.
Measured, 2026-10-04 (UTC), QEMU on a developer machine
The suite runs seeds 0 to 31 and the corpus seed 180: 33 seeds, 1,517 calls (800 refused, 338 parked, 40 delegations, 15 replies, 42 revokes). All three ISAs ran the same 1,517 calls with the same census, which is the determinism claim measured.
| ISA | wall time | seeds/s |
|---|---|---|
| aarch64 | 338 ms | 97 |
| riscv64 | 612 ms | 53 |
| x86_64 | 329 ms | 100 |
CI cost per merge is under a second of guest time per ISA plus the compile of one test module.
The six falsifications
Replayed on aarch64 with the committed seeds, each patch applied alone. All six turn it red.
patch (system_tests/falsifications/user.<module>.<test>.patch) |
seed | step | the mismatching call |
|---|---|---|---|
receive_cap_attack_tests.a_call_server_tells_its_reply_from_a_delegation_on_both_arrival_orders |
0 | 17 | CALL woke a parked RECEIVE_CAP with x4 = 0; the model says REPLY_DELIVERED |
receive_cap_attack_tests.a_plain_send_to_receive_cap_delivers_no_cap_whichever_side_parks_first |
0 | 18 | SEND woke a parked RECEIVE_CAP with x1 = 1 (the sender's word); the model says NO_CAP |
receive_cap_attack_tests.a_death_message_received_by_receive_cap_delivers_no_cap_whichever_side_parks_first |
0 | 18 | the same hunk, so the same call |
receive_cap_attack_tests.an_interrupt_signal_received_by_receive_cap_delivers_no_cap_whichever_side_parks_first |
0 | 18 | the same hunk, so the same call |
receive_cap_attack_tests.a_send_cap_collected_by_a_plain_receive_stages_nothing_for_a_later_plain_send |
19 | 63 | RECEIVE_CAP returned x1 = 2, a stale delegation; the model says NO_CAP |
revocation_in_flight_tests.a_capability_revoked_while_it_is_in_flight_does_not_reach_the_receiver |
559 | 14 | RECEIVE_CAP returned x1 = 6, a revoked frame; the model says NO_CAP |
The last two rows were re-measured on 2026-10-04 (UTC), on aarch64, riscv64 and x86_64, after
§246 (a plain RECEIVE never takes a capability) changed the generated sequence; they were 180
at step 75 and 5 at step 39. Seed 342 joined the corpus in commit f7dcd3dca, and the recheck
is commit 134923b38 (PR #1611). Seed 342 rotted between 2026-10-04 and 2026-10-08 (UTC), found by
milestone 139 (drive the unsafe count down) round 10's sweep: its record survived its own defect on
the claim commit too. A
5,000-seed sweep under the same patch re-found the defect at seed 559, step 14, red on aarch64,
riscv64 and x86_64, and the row above carries 559.
Three patches are byte-for-byte the same hunk (milestone 634 (a plain SEND received by RECEIVE_CAP never hands the receiver a sender-chosen slot)), so four defects are distinct.
The first cut missed two. With four actors and random rights, 24 seeds went green under the patches for milestone 633 (an outside agent attacks the confinement claim) and for revocation in flight; a 5,000-seed sweep found both (seeds 751 and 271). After the endowment was biased toward whole rights and the actors went from four to six, a second sweep found every patch by seed 180, and seed 180 became the corpus. The weekly sweep is what finds the next one.
The weekly sweep
.github/workflows/falsifications.yml, job system-call-fuzz, on milestone 616 (constrained hardware
fuzzing for the boot path)'s cadence. It starts at the ISO week times a million, runs seeds until
60 s of guest time have passed (under the 90 s per-test budget), and prints the range it covered.
At the aarch64 rate above that is about 6,000 seeds a week. A finding is a red scheduled run, never
a red trunk. Not yet run on a runner; the first scheduled run is its measurement.
A real finding, and it is an architect's call
A capability reaches a plain RECEIVE on one arrival order only. A SEND_CAP or CALL that
finds a plain RECEIVE parked installs its capability in the receiver's table and returns the slot
in x1. In the other order the receiver gets no capability (633's fix), and a CALL caller
collected that way waits forever for a Reply nobody holds. The suite reached it 12 times in 33 seeds
and the model pins today's behavior, so the test is green and any change is seen. Recorded at
abi::rendezvous::RECEIVE's BUGS.
It is exploitable today. A std program, including an unvouched one, is spawned holding its own
memory region with WRITE in slot 0 (StdLayout::new in crates/system_initializer/src/std_layout.rs, its
caps). MemoryRegion::RETYPE checks only WRITE and returns a frame with Rights::ALL
(kernel/src/system_call.rs, memory_region_retype), so the program holds a GRANT capability it can
SEND_CAP again and again. Its stdout is a rendezvous that a plain-RECEIVE server drains. Every
delegation that finds that server already parked costs it one of its 32 slots, and none of these
servers reads x1, so none is ever freed. Native programs given --mem are in the same position;
native programs without it hold no GRANT capability.
server (plain RECEIVE) |
endpoint | holders of WRITE |
a holder with a GRANT capability? |
|---|---|---|---|
swish, reading a child's output (drain_text, run_image and spawn in components/src/swish/running.rs, and drain_into in components/src/swish/pipeline.rs) |
the child's out |
every spawned child | yes: std children, --mem children |
swish, draining diagnostics (drain_diagnostics in swish/running.rs) |
the diagnostics rendezvous | stages that declare diagnostics | yes, if the stage is std or --mem |
terminal_sink_caretaker (:80) |
the terminal sink | children given the default diagnostics or a screen tail | yes: a std child on that path |
wc, mdr (count in wc.rs, _start in mdr.rs) |
the pipe source | the upstream stage | yes if upstream is std or --mem (not traced end to end) |
console (start in console.rs) |
requests | line_editor only |
trusted |
system_log (:151) |
intake | no untrusted holder at boot | no |
supervisors, job_undertaker, timetable, swapper, report endpoints |
fault, death, note, report | the kernel or trusted components | no |
So a confined program can fill swish's table today, and the shell is the process that spawns everything else. Read from the code by a sub-audit on 2026-10-04 (UTC), with the key sites checked by hand; not driven end to end under QEMU.
The seven questions:
- Options. (A) Plain
RECEIVEnever takes a capability: aSEND_CAParriving second delivers its data and drops the copy, as the sender-first order already does, and aCALLthat reaches a plainRECEIVEis answeredGone. (B) PlainRECEIVEalways takes one, reverting 633's sender-first drop; lost, because a receiver that did not ask still gains authority. (C) Refuse aSEND_CAPat a receiver that did not ask; lost to (A), because the sender-first order cannot refuse (the sender has already parked and been told nothing) so the two orders would still differ. (D) seL4's sender-side gate, below:SEND_CAPneedsGRANTon the endpoint capability itself. A further rung, not a substitute: it closes this only where everyoutis handed out withoutGRANT, which is a sweep of the grant sites, and it does not make the two orders agree. (E) Leave it recorded; lost, because it is exploitable. - This tree. The sender-first order is (A) for
SEND_CAP(sched::ipc_receivedropsoutgoing_cap). Of the plain-RECEIVEsites incomponents/,crates/,fixtures/andsrc/, none readsx1as a slot and noneREPLYs afterwards:user_mode_runtime::replyaccepts only a typed Reply, and onlyreceive_request(aRECEIVE_CAP) builds one. EveryCALLserver in the tree receives withRECEIVE_CAP(the caretakers, the drivers,line_editor,credentialer,entropy,net_stack, the compositor,swapper, the fixtures), and everyCALLclient targets one of them. The std port makes noRECEIVEat all. SoCALLansweredGoneat a plainRECEIVEbreaks no program in the tree. - Prior art, read: the seL4 Reference Manual,
manual/parts/ipc.texat seL4 commitc6ce4d2a0c. Section "Capability Transfer" copies capabilities "provided that the endpoint capability invoked by the sending thread has Grant rights". Without it the send is "a transfer of the raw message, without any capability transfer". The receiver names the one slot it will accept a capability into (receiveCNode,receiveIndex,receiveDepth). If that slot cannot be looked up, the transfer ends and "no error message will be returned to the receiving thread". Section "Calling and Replying" puts aCall's reply capability "in a specific slot of the receiver TCB", outside any CSpace, so a plainseL4_Recvcan always answer aCall. So seL4 has the receiver opt in and the message arrive regardless, which is (A) forSEND_CAP, and it gates the sender as (D) does. Its Reply needs no receive slot because it lives outside the capability space. Nife's lives in the table, so aCALLat a plainRECEIVEhas nowhere to put it, andGoneis the honest answer. - Premise. Verified on three ISAs (12 occurrences in the committed seeds); the code is
sched::ipc_send_capandipc_call_badged's receiver-first arms. - Cost, measured on a throwaway branch (never pushed, deleted) carrying (A): a
receiving_capflag set at each receive's park, and a branch in the two receiver-first arms.script/fastpath-footprint,ipc_call_reply: aarch64 7,044 to 7,116 B (+72, +1.0%), riscv64 6,106 to 6,166 (+60), x86_64 8,227 to 8,339 (+112, +1.4%).ipc_send_receivemoved 4 B or less, and all are inside the 5% band.script/bench(aarch64, TCG and icount):call_reply1,072,267 to 1,072,517 ticks over 1,000 iterations (+0.02%),ipc_rtt1,046 to 1,061 ticks per iteration (+1.4%),ipc_rtt_el0+0.1%,null_system_callunchanged. The sender-firstCALLarm (answer the stranded callerGone) was not in the measured patch and adds a branch off the fastpath. - Reversibility. A change to what
RECEIVE,SEND_CAPandCALLreturn: §10 (the capability-based microkernel process model)'s surface. Nobody has acted on today's behavior (the audit above), so the change is cheap now and gets dearer with every program written against it. - At equal cost. (A) either way; the measured cost is small, so this is not an effort argument.
Recommendation: (A), with CALL at a plain RECEIVE answered Gone, on both orders. It closes a
hole reachable today, breaks nothing in the tree, makes both orders say the same thing, matches
seL4's receiver-opts-in rule, and costs about 1% of the CALL closure. (D) is worth a later look as
a second rung. When (A) lands, the driver's model changes in the two receiver-first arms and the
cap_to_plain_receive census becomes a count that must stay zero.
Follow-on
- Recorded. The plain-
RECEIVEfinding above waits on an architect (adesign/decisions/section is the integrator's to mint), and is recorded meanwhile inabi::rendezvous::RECEIVE'sBUGSand the driver'sBUGS. - Recorded. What the generator does not reach (timers,
MemoryRegion, TCBs, a bound notification, death messages,PageFrame::MAP), in the driver'sBUGS. A Nth-retype test can reuseModel,Stageand the actor loop by adding anObj::Regionand its methods.
BUGS
- Both seeded drivers, this one and the confined driver of milestone 779 (fuzz the surface a
confined process can reach), wait with
testing::wait_on_every_core: two seconds of ticks on every online core, then a 20 s backstop on the counter. A vCPU the host stops takes no ticks, so it holds a wait open and does not fail it. A host that stops a vCPU for longer than the backstop still fails a run, and the message then reads "(the backstop)" beside a core with few ticks. - Side by side under KVM, two-second deadlines on the counter failed up to half of the guests at
8 and 16. With the every-core wait, this driver failed 1 of 552 guests at 4 to 16 and the
confined driver 0 of 64; the table is in
notes/fuzzing/rates-on-x86-64-under-kvm.md. - That one failure is not explained. On 2026-11-01 (UTC), at 8 guests, actor 5 neither finished
nor parked after 2732 ms of the counter. In that time core 0 took 200 ticks and core 1 took 255,
so both cores ran and no stopped vCPU covers it. The message printed no seed then. The failure came about
13,300 seeds into the sweep; seeds 900,012,000 to 900,015,000 passed alone 3 of 3 times, and
every other guest passed the same seeds. A wake the scheduler lost (the class in
notes/scheduler/missed-reschedule-poke.md) would fit; so would a host stall that ticks did not show. A budget-expired failure printssched::dump_threadsafter its message (thread states, and each core'sinbox_len), so a recurrence shows which threads sat parked, runnable or waiting. Every budget-expired message of both drivers carries the seed it was running. - On the continuous fuzz host, both drivers' waits run out in bursts that cross guests. The host is itself a virtual machine, so its four guests run under nested KVM. In a burst, every vCPU of every guest runs flat out for tens of seconds while the guests make little progress. Each core still takes its ticks on time, about 200 in 2,000 ms of the counter, so the every-core budget runs out as if the guest had hung. Kernel-thread and confined windows that start within a second of each other fail together, far more often than chance gives. Their seeds replay clean on a second nested host, one guest at a time and eight at once. In the thread dump the awaited thread is most often running or runnable, not parked. That reads as slowness, though a lost wake is not ruled out. What starts a burst is not known. The fuzz host's own scheduler shows no run-queue wait and next to no steal, so the cause sits below it. A tick budget cannot tell such a burst from a hang. No measured figure for a burst fits under the 20 s backstop.
- A stopped vCPU is what the wait exists for, and an instrumented run on 2026-11-01 saw one. Four guests at once waited about 1.8 s. One loop went 1.54 s between two polls, and its guest took 6 or 7 ticks where two running cores take about 360. What stops them is not known; four guests pinned to four host CPUs beside eight busy loops saw no stall, so CPU contention alone is not it.
Index row
A seeded driver issues random capability operations through the real system call layer and predicts
every answer and every capability table from a shadow model, so a confinement defect that crashes
nothing still fails. BUILT: runs on all three ISAs, red under all six recorded kernel
falsifications, and found that a capability reaches a plain RECEIVE on one arrival order only.