notes

The proof: one binary, three behaviors

An appendix to notes/std.md, which is the page to read. This file holds what std_exerciser does under each grant, which kernel tests spawn it, and the small std programs beside it. The directory notes/std/ and this file's stem are provisional names. Naming is calef's.

The records this file cites by number:

The proof

std_exerciser/src/main.rs is an ordinary Rust program, no no_std, no unsafe, and two #![feature] gates that are both about an API's stability upstream rather than about this platform: std::random (rust-lang/rust#130703) and, since milestone 122, std::fs::Dir (rust-lang/rust#120426). A program on any target calling those opts in the same way. It is one binary with three behaviors, chosen by the authority it was granted: on start it probes for a directory capability (File::open on the fixture name) and then for the network (a single UdpSocket::bind), and the results branch it.

The same binary doing three things by its grants alone is the point of "no ambient authority": the code never chose to have a network or a filesystem, its capability table did. All three tests reassemble the byte stream off the endpoint and compare it byte for byte, on both ISAs out of each arch's own initrd (the parity gate, DECISIONS §19). The fs transcript splices the file's own bytes into the expected buffer from the shared fixture. So that one comparison covers the whole path: disk, DMA-confined block server, FS server running an engine we did not write, the file contract, the PAL, and the stdout endpoint. One binary also keeps the initrd inside its nifefs directory limit (nifefs::MAXIMUM_FILES, 31 entries when this was written and 76 since 2026-08-01). cargo xtask test builds the demo for both targets first, so both initrds carry it; both test legs attach a virtio-net NIC (NIFE_NET) with the guestfwd echo peer and the RedoxFS image as the second disk.

One boot has one FS service, because the block server owns the RedoxFS device: a second wiring would put a second driver on the same virtio slot and re-bind its interrupt. So fs_service remembers what it wired, and the hand-written client's test and the std::fs test share one instance; whichever runs first receives the two readiness sentinels (each is sent once) and the other sees None and skips those assertions. That keeps the two tests order-independent, which matters because nothing guarantees which of them the harness runs first.

Why each check is shaped as it is

std_exerciser's comments give the constraint at each check. The reasons behind them are here.

On every run:

Granted a directory:

Granted the network:

The small std programs

std_exerciser/src/bin/ holds programs too small or too specific for the main binary.

What the offline transcript's lines guard

std_tests::a_whole_std_program_runs_on_the_native_abi grants a heap, a stdout endpoint, a clock and a configuration page. Several lines of its transcript guard a call that once compiled and then killed the program, so a test that only checked for no crash would have passed:

How the tests read a std program's stream

std_tests::drain_sink is the one decoder for every sink in the suite. It ends only on the sink's end-of-stream marker, which the runtime's cleanup sends after main returns. A program that panics under panic = "abort" traps instead. Every byte it printed, the panic message included, reaches the endpoint and is never read. The caller blocks until the watchdog fires, and the transcript reads as empty, which is indistinguishable from a program that never started. A program can work around it with a panic hook that prints and then calls process::exit, as cryptography_exerciser does. drain_sink stays for callers whose starter does not hand back the writer's thread, and each of those is a hang waiting for its first abort.

std_tests::drain_sink_from is for a caller that knows the writer's thread (milestone 514 (the HVF std listener hangs in some full runs)). Without it, a writer that aborts leaves the reader parked, and the suite's watchdog fires a minute later and calls it a lost wakeup. The calling thread binds a notification and arms a timer on it every WRITER_CHECK_MILLISECONDS. A bound notification ends a RECEIVE (§101 (notification objects), the x4 == BOUND tag), so the receive returns a sink message or a tick. On a tick it asks whether the writer's thread still resolves, and a name is generational, so "gone" means gone. It is a poll, not an event, because an unsupervised thread's death signals nobody. Making it an event would mean spawning the writer supervised, which changes who reaps it. echo prints each line as it arrives, indented under the test's own line, so the host relay can stamp it on the inbound prober's clock (xtask/src/inbound.rs). The comparison is made on the bytes either way.

The tick is a wake, and a wake is progress to the suite's lost-wakeup watchdog (testing::watchdog_tick). So a writer that is alive but stuck runs to the test's own budget (90 s by default) and is reported as a livelock, where without the tick the watchdog would trip at 60 s. The dump that follows names the stuck thread either way.