roadmap BUILT

522. A boundary drawn by dependency, not by path, is what finds the 117 blocks a path split misses

The contribution is the boundary, not the count. script/metrics's unsafe_outside_arch (824, density 77 per 10,000, script/lint's ceiling 88) answers "how much of the tree's Rust is unsafe outside kernel/src/arch/". Nothing in that number distinguishes code nothing confines from code the kernel's own MMU-plus-capability-table mechanism confines like any other program. A hand computation (notes/trusted-base.md, the maintainer/redleaf-comparison lane, now published in a comparison against Tock and RedLeaf) drew that boundary at kernel/src/ versus everything else. It got 577 kernel blocks against 561 elsewhere. That boundary is a path prefix, and a path prefix is the wrong instrument. Sixteen crates/ members, paging and dma_validator and inter_process_communication among them, were lifted out of kernel/src on purpose so Kani could reach them. Every one of them ships only in the kernel binary. A path-only split cannot see that they never leave the trusted base just because their directory changed. It counted their 117 unsafe blocks as if they were userspace's.

The boundary this milestone draws instead is a real dependency edge, read once from cargo metadata --format-version 1 at the repository root. A crate is kernel-trusted if the kernel package reaches it over an edge that is not exclusively dev. It is userspace-confined if only components or fixtures (the two packages holding every EL0 program, milestone 175 (split user/: components/ for services, fixtures/ for test and benchmark programs)) reach it that way. And a fifth population, shared, when both do. That is mechanical and checkable in a way a hand-drawn line is not. It is what catches the 117.

The four categories, and the four densities

What was found and deliberately not folded in

Three crates/ members are host tooling unsafe_census's own HOST_ONLY exclusion does not catch: board_console, portable_executable, stick_maker. Each says so in its own header (stick_maker's: "A host program, not a nife program. It runs on macOS, Linux and Windows and never on nife"); each is read only by xtask or invoked directly, never by a nife binary. They sit under crates/, not one of HOST_ONLY's path prefixes (bench/host/, xtask/, tools/, fuzz/, helpers/, patches/). So the existing census counts their 6 unsafe blocks as if they ran on nife.

This was found and is reported here, and unsafe_census()/unsafe_outside_arch/script/lint's ceiling are left exactly as they were. The 824 and 77 that script/lint still gates on mean precisely what they meant before this milestone. Widening HOST_ONLY to also exclude these three crates is a real, small correction (it would move the published 824 to 818 and the density from 77 to roughly 81). But it is a decision about an existing gate's inputs, not a byproduct of drawing a new one, and it is an architect's to make.

The earlier weeks, and why a gap in them is not a bug

script/metrics --backfill restated this split across all ten prior weeks. Eight of them carry a nonzero unsafe_trust_unclassified (57 to 188 blocks). This tree spells its crate names out (design/naming.md), and around forty crates did not always have today's spelling (crates/ipc became inter_process_communication, crates/dtb became device_tree_blob, and so on). So the classification table, built from today's names, cannot see them under their old ones.

This was not reconstructed from git's own rename detection, and that refusal is itself a finding. git log --diff-filter=R --summary offers candidate renames, and at least one it offers is wrong. crates/canary_gate pairs with crates/work_steal_slot at 96% on a Cargo.toml-only match. canary_gate's own src/lib.rs correctly pairs with memory_corruption_canary_gate at 97%. A hand-verified alias table for around forty old names, several of which (mdns_proto, smb_proto, ntlm) name protocols since removed outright with no current bucket to map to at all, is real work. This milestone chose not to rush past a false pairing. A future reader who sees the gap in the series and assumes it is a bug should read this instead. It is a recorded limitation, not an oversight, and it is exact from 2026W38 (2026-09-20) onward.

The ceiling question, answered as a recommendation and not a change

script/lint's <!--count-at-most:unsafe-density-outside-arch--> (notes/unsafe-obligations.md, currently 88 against a mixed density of 77) is a ceiling over the population this milestone shows is two populations. If a ceiling is held against the split, kernel density (142 per 10,000) is the number it belongs on. It is the population a mixed number's blind spot actually lives in: unsafe code nothing confines. Userspace density (120) matters less for the same reason a bug there is a bug in one confined program rather than in the base. This is a recommendation. Changing script/lint's 88, or setting any ceiling on the new columns, is an architect's, not this milestone's. A ceiling started cold has no history of it moving deliberately the way 88 was cinched down six times (milestone 134 (the register of measures: every number this kernel owes itself)). That history is worth having before a number is chosen.

What this means for the published RedLeaf/Tock comparison

notes/trusted-base.md states 577 as the kernel's unsafe count, in a comparison against Tock and RedLeaf's own published trusted-base figures. That number is drawn at the kernel/src/** path boundary and is short by the 117 blocks the sixteen kernel-only crates/ members carry. That is exactly the risk that note's own BUGS section names (moving code out of kernel/src can shrink a line count without shrinking what anyone has to trust), without having checked whether it had happened to its own figure. The maintainer is correcting that note separately, citing this milestone for the number; this milestone does not touch it.

BUGS

Follow-on

Index row

script/metrics's unsafe_outside_arch mixed unconfined kernel code with confined userspace code into one density. This milestone draws the boundary as a real cargo metadata dependency edge rather than a path prefix. That is what finds the 117 blocks of sixteen kernel-only crates/ members (paging, dma_validator, inter_process_communication among them, lifted out of kernel/src on purpose for Kani) that a path-only split counts as userspace's. The split, backfilled across history with its gaps stated rather than guessed at, is kernel 694 blocks at density 142 per 10,000, userspace 382 at 120, shared 19, boot chain 37. script/lint's ceiling is left untouched, with a recommendation, not a change, that a future one belongs on the kernel density.