notes

Trusted init: measuring the boot program, and then everything the progenitor loads

Milestone 22 phase B.1. The kernel hashes the boot program and refuses to enter it unless the digest matches one compiled into its own image. Milestone 104 continues the chain from there: everything the progenitor loads is measured too, in userspace, against a table the kernel vouches for. This note is the why and the mechanics; the decision record is DECISIONS §26's milestone-22 phase B block, and the supervision half of milestone 22 is notes/supervision.md.

Read the first half for the mechanism (SHA-256, the trust root, failing closed) and "The chain continues past the progenitor" for its reach.

The gap this closes

DECISIONS §14 promises "a verified core that confines unverified workloads." the progenitor is unverified but it is not a typical workload: it holds the process-construction authority and builds every other process in the system.

At runtime the kernel confines it about as well as anything can be confined. MMU isolation is proved, its code is mapped W^X, capabilities are unforgeable, and a compromised progenitor cannot break the kernel or escape its own confinement. What was missing was earlier than that:

B.1 is the first of those. Phase B.2 is the second.

Why it is not theater

A check on bytes in RAM is worthless if something can rewrite them between the check and the use. The IOMMU work of milestone 16b (DECISIONS §20) closed exactly that window: a device can no longer DMA over the initrd behind the kernel's back. So the sequence "hash the bytes, then parse and enter the same bytes" is now a real ordering, not a hopeful one. Measured boot arrived after DMA confinement on purpose.

What the kernel does

Three pieces, no new system call, no new capability, no key material.

  1. The build measures. xtask packs the initrd archive, parses the packed image back with nifefs, hashes the boot-program entries, and writes target/init-measure-<arch>.txt:

    # generated by cargo xtask; the boot programs this aarch64 kernel image is built against
    init 57ad22d9ddfbeb59d06ac2820eda2eb9e44e9c49d64f0e10f7e4484d32ca669a
    

    It hashes the bytes read back out of the archive, not the input ELF file, deliberately: what must be measured is what the kernel will read. If packing ever mangled an entry, this measures the mangling and the boot fails, which is the correct direction to be wrong in.

  2. The kernel image carries the digest. kernel/build.rs reads the manifest and generates TRUST_ROOT: &[measured_boot::Measurement] into OUT_DIR; kernel/src/trust.rs includes it. The expected value is part of the thing doing the checking, which is what lets this work with no keys and no certificate chain.

  3. The boot path refuses. trust::require(name, bytes) runs before the boot program's address space is built: boot_progenitor on every architecture, and riscv's riscv64_initial_ramdisk_demo. For the test child builders that spawn_elf_child_builder enters, the kernel checks the archive's table instead (trust::require_program_in). On a mismatch it prints what it expected, what it measured, and calls arch::halt().

The meaning of the whole arrangement is one sentence: this kernel image runs exactly this progenitor.

Failing closed, in both directions

require halts the CPU it is running on (loop { wfi }), which on the boot path is the boot CPU before any other work has been placed. The honest caveat: on an SMP machine the other harts are not stopped by this, they are simply idle, because on this path nothing has been spawned yet. A general-purpose "stop the machine" primitive is not needed to make the guarantee ("the wrong progenitor never runs") hold.

The hash: SHA-256, hand-written, one implementation

crates/measured_boot is about a hundred lines of shifts and adds: no dependency, no allocation, no unsafe, no_std, host-tested.

Why a cryptographic hash at all

The threat is someone substituting the initrd bytes. A fast non-crypto hash (xtask already has an FNV, used to notice stale build inputs) would let an attacker craft a colliding progenitor, which defeats the entire exercise. Collision and preimage resistance are the requirement, not speed.

Why SHA-256 rather than something newer

Among the collision-resistant options it costs the trusted computing base the least. BLAKE3 is faster and would be a dependency (or several hundred more lines of tree hashing inside the boundary we are trying to keep small); SHA-3 is a second permutation to audit for no gain here. SHA-256 is small, boring, and checkable by hand against shasum -a 256 on any machine on earth. Speed is not a constraint: it runs once per boot over a 1.2 MB ELF, before the first user instruction. (It is compiled at opt-level = 2 even in debug builds, via a [profile.dev.package.measured_boot] override, because an unoptimized SHA-256 is a visible tax under TCG and there is nothing in it a debugger wants to step through.)

Vendored or hand-written: hand-written

A vendored crate would be more code and a supply-chain edge inside the TCB, to save a hundred lines of arithmetic whose reference text is public and whose test vectors are published.

One implementation, both sides

The build (on the host) and the kernel (no_std, at boot) hash through the same crate, so there is exactly one definition of the measurement. That is the same discipline nifefs gets as the one parser for the archive, whether it lives on a disk or in RAM. The risk that trades for is an implementation agreeing only with itself, so the tests are the published FIPS 180-4 vectors (empty, "abc", the 448-bit padding case, and a million as streamed), not self-consistency. It was also cross-checked against macOS shasum -a 256 over the real 1.2 MB progenitor ELF, which matched, so the digest in the kernel image is a genuine SHA-256 of a real file.

How the build composes, and why there is no chicken-and-egg

The kernel image contains the hash of a separately built initrd, so the order is forced:

userspace ELFs  ->  nifefs archive  ->  measurement manifest  ->  kernel image

The dependency runs one way only. The hash never feeds back into the initrd, so nothing is circular. It is the ordering the build already had: every xtask path builds user() before the kernel, because the kernel boots with the archive as -initrd. It is now made explicit and enforced by cargo::rerun-if-changed on the manifest.

Two consequences worth knowing:

What is proven

Why the refusal path itself is not booted in a test

A real refusal halts the machine, so a test cannot take that branch and survive. What a test can prove, and what actually carries the weight, is the decision: the same function the boot path consults says Ok for the bytes in RAM and Err for bytes off by one bit. The boot path's only response to Err is arch::halt(), three lines away in trust::require, which is the kind of thing a reader can check by looking. Recorded plainly rather than papered over.

The signature variant, recorded and not built

A signature over the progenitor against a public key compiled into the kernel would buy one thing the hash cannot: updating the progenitor without rebuilding the kernel. The tradeoff, and why the hash came first, is in DECISIONS §26's milestone-22 phase B block. Short version: signature verification (Ed25519: field arithmetic, point decompression, SHA-512) enters the trusted computing base. And key custody becomes a real question that a hash does not ask: where the private key lives, how it is rotated, what revokes a compromised one. The peer project Atom ships Ed25519-signed executables, so it is a real and reachable option, just a bigger TCB. It becomes worth its cost when the progenitor is delivered independently of the kernel, which is not true today: they are built by the same command, in the same tree, in one sequence.

Recorded-accepted by milestone 94's sweep (2026-08-04), with one thing owed. The sweep's judgment stands: the hash is the decision, the signature is the alternative, and the condition that would make it worth its cost is stated, so an audit may pass over it. What is owed is the promotion. §71 (a limitation is promoted when it becomes a plan) names this entry as the shape of its second trigger: a design fork an architect must rule on before any lane could start. That is the one case that lands as a NOT-STARTED roadmap row behind a decision dependency. No such row exists yet. Minting one is the integrator's act and not a lane's, so this paragraph is the flag rather than the fix. See notes/untracked-work-sweep.md.

Phase B.2: shrinking what a broken progenitor can do

B.1 settled what bytes the progenitor is. B.2 is the other half: what a compromised progenitor can still reach. The answer is not to make the progenitor more careful; it is to make it hold less, for less time. A supervision tree of four small programs proves the pattern. root_supervisor hands a spawner one program image and a budget it may spend but not lend, hands sub_server_supervisor no memory at all, and then deletes its own untyped. Restart policy is userspace code.

The proof is that after the handoff, retyping answers NoSuchSlot from inside the process: there is nothing there, rather than something it may not use. The work also found a race in the exception-return path on both architectures, fixed in notes/exceptions.md. The tree, the proofs and the two design forks it found (both since answered) are in trusted-init/supervision-tree.md.

The interactive boot, migrated

The boot path a person types at keeps the ELF loader, because moving the loader out would relocate the archive's authority rather than reduce it. It gives up three other things instead: the root construction budget (it keeps a 128-page scratch budget and a 240-page job pool), the UART and its interrupt once the drivers are built, and every live job's region. The pool is bounded because it is renewable: job_undertaker, whose only authority is one endpoint, reaps each finished job back into it. script/swish-check reads the progenitor's own report that its budget is gone, then runs thirteen jobs through a six-job pool.

Recovery is LIFO, so two jobs alive at once can permanently cost a region, and a hung job is not collected. Until 2026-10-05 (UTC) the progenitor also kept a writable mapping of everything it built. build_child's scratch window is never unmapped (it cannot be: nothing in the ABI unmaps a page), so the progenitor can read and write any page it laid down for a child. That sentence is kept here because §162 (whether a holder can give up a mapping) quotes it; §249 (a running address space stays nameable) closed the gap, and the loader now unmaps each page once it is in the child. Milestone 96 (one init: the spawn service written twice) made crates/system_initializer the one progenitor and supervision_contract's builder the one loader. The shape, the proofs and the BUGS in full are in trusted-init/interactive-boot.md.

The chain continues past the progenitor (milestone 104)

The progenitor measures every program it loads, in userspace, against a table packed as an archive entry, program_measurements (name provisional). The kernel gains one digest and no policy: it hashes the table beside the progenitor and halts if either is not what the image was built against. The progenitor grants nothing of its own to what it cannot vouch for. A refused program is treated as a missing one: a boot component stops the boot, and a leaf program cannot be spawned. A name the table does not mention is a refusal, and a missing or unreadable table vouches for nothing.

A refused console or line_editor stops in silence, and the prompt blames memory for a refused program. The supervision tree and c_confiner still load unmeasured bytes; both are QEMU-only. Where the table lives, the policy table, the proofs, the BUGS and what is still not covered are in trusted-init/chain-past-the-progenitor.md.

The alternative that was rejected, and stays rejected

Hashing the whole archive in the kernel covers everything with one value. It puts a 14 MB hash at every boot and the policy that decides what is acceptable inside the trusted computing base, which is the wrong place for both. The table in trusted-init/chain-past-the-progenitor.md costs the kernel one 4 KB hash and no policy at all.