P1: before the tag
An appendix to the milestone.
P1: before the first tag
-
The accessor totals are not total functions, and a reader panics on a page it accepted. Finding:
Snapshot::sumfolds withIterator::sum, which panics on overflow in a debug build and wraps in a release build.from_wordsadmits any page with the magic and the version. A page whose counters are large (a writer other than this kernel, or a corrupted frame) therefore makesbusy_ticks,idle_ticks,context_switches,interruptsandrunnablepanic in a reader that validated its input.total_bytesandfree_bytesalready saturate, so the crate is inconsistent with itself. Verified with a scratch test: every counter atu64::MAXunder a valid header,busy_ticks()panics with "attempt to add with overflow". With eight lines the sum of eight words cannot overflow unless each exceeds 2^61, which no honest kernel reaches, so this is a hole in the claim, not a defect a user of this kernel can reach. Evidence:crates/machine_statistics_contract/src/lib.rslines 270 to 272 and 260 to 268. Change: fold withu64::saturating_add, one unit test over a page ofu64::MAXcounters that pins every accessor tou64::MAX, and the harness of item 7 that states every accessor is total. Door: two-way. Effort: S. -
counterreturns a'staticreference under a contract that promises less, and does not say what a reader may do with it. Finding: the safety section says the buffer must be "live for the call", and the function returns&'static AtomicU64, so a caller who keeps the contract can still hold the reference after the mapping is gone. The int-to-pointer castpage_va as *const AtomicU64has no provenance, which Miri warns about and which a*const u64orNonNull<u64>parameter would give it. The function is public and generic, and nothing says that a reader holding a read-only mapping may only load. The standard library states that every atomic access to read-only memory is undefined behavior except aRelaxedload of at most eight bytes on the 64-bit targets this crate builds for. That is exactly the shapeSnapshot::readuses without saying why. On a target with a pointer narrower than 64 bits the cast truncates the address silently; every target the crate names is 64-bit, so this is a hole in the claim. Evidence:crates/machine_statistics_contract/src/lib.rslines 134 to 145 and 242 to 256;core::sync::atomic, "Atomic accesses to read-only memory". Change: make the lifetime the caller's (unsafe fn counter<'a>(...) -> &'a AtomicU64, orAtomicU64::from_ptr, which is std's spelling of the same operation and carries the same contract). Take the address as a pointer, or keepu64with a sentence that it must be representable as a pointer plus aconstassertion that the fixed address fitsusize. Write two sentences atread. The loads areRelaxedbecause the mapping is read-only and std guarantees only that shape there. A reader must not store or read-modify-write throughcounter. The kernel's writer in this tree does not usecounter; its only caller in the tree isread. Door: two-way (the signature changes before any release). Effort: S. -
The layout's line count belongs to another crate, and a change there moves this page's layout without a version bump here. Finding:
WORDS = word::LINE * (1 + CPU_ID_BOUND)withCPU_ID_BOUNDre-exported fromcurrent_cpu_contract. A release of that crate raising the bound changes this crate'sWORDSandPAGE_CONTENT_BYTESat the next build whileMAGIC,VERSIONandINTERFACE_IDstay. A reader built against eight lines then misses cores a sixteen-line kernel writes, and both agree on the identity. The kernel'sMAXIMUM_CPUSis the same constant, so inside this tree the two cannot drift, but across two pinned repositories they can. Evidence:crates/machine_statistics_contract/src/lib.rslines 27 and 51;kernel/src/cpu.rsline 28. Change: this is Decision 1, ruled 2026-11-14 (UTC), option A. The crate carries its ownPROCESSOR_LINES: usize = 8(name provisional) and aconstassertion that it equalscurrent_cpu_contract::CPU_ID_BOUND, so a bound change fails this crate's build and forces a version decision here instead of moving the layout silently. The re-export ofCPU_ID_BOUNDis gone, and every user of it namesPROCESSOR_LINES. The doc comment atPROCESSOR_LINESstates that the line count is part of what the version names. Door: one-way (layout). Effort: S. -
Nothing is machine-checked, and the README's "What is proven" section will have nothing to say. Finding: no
#[kani::proof], nofalsifications/directory.cargo kaniexits 0 with "No proof harnesses were found", so the template'sproofs / kaniandproofs / falsifyjobs pass without proving anything; the review verified this on the copy, which the sibling reviews had left open. The reader's two decisions, the magic compare and the version compare, and the totality of every accessor are small enough for Kani to close over every page. Evidence:crates/machine_statistics_contract/src/lib.rslines 211 to 240 and 258 to 308;crates/block_roster_contract/src/lib.rslines 484 to 560 (the pattern). Change: averificationmodule behindcfg(kani)with three harnesses, each with a falsification patch the template replays red. The first takesfrom_wordsover arbitrary words and statesNoneexactly when the magic word or the version word differs, and otherwise that every field equals its word andonlineis the nonzero test. The second states that every accessor of aSnapshotbuilt from arbitrary words returns without panicking (after item 4). The third states thatbuild_header(f, h)followed by zeroes reads back as a page withframe_bytes == f,tick_hertz == h, no online cpu and every total zero. The README's "What is proven" section then names them and says that no proof covers the caller's mapping promise. Door: two-way. Effort: M. -
The two
unsafefunctions have no host test, so Miri never sees them. Finding: coverage places the only uncovered lines incounterandSnapshot::read. The host tests reach the reader libraries and the kernel throughfrom_wordsandbuild_headeron the host and reachreadonly under QEMU. A host test over an aligned frame is cheap, passes under Miri (the review ran one), and is the only place the&AtomicU64shape over a buffer gets checked outside a running kernel. Evidence: cargo-llvm-cov, lines 142 to 145 and 249 to 256 uncovered. Change: one test with a#[repr(align(4096))]frame ofWORDSwords that writes a header and one cpu line and reads it back throughread. The test reaches the frame throughas_mut_ptrso Miri accepts the atomic shape. A second test reads an unprepared frame asNone. Door: two-way. Effort: S. -
The
wordmodule mixes absolute header indices with per-line offsets under one namespace. Finding:word::MAGICthroughword::VERSIONindex the page;word::ONLINEthroughword::RUNNABLEare offsets into a cpu line, added toword::cpu(id). Both are plainusizeconstants in one module, andword::ONLINE == word::MAGIC == 0, sowords[word::ONLINE]compiles and reads the magic. The doc comment on the module says the rule; the types do not. Evidence:crates/machine_statistics_contract/src/lib.rslines 79 to 120. Change: two submodules (word::headerfor the absolute indices andword::linefor the offsets, names provisional) or an_OFFSETsuffix on the per-cpu constants; a typed index is heavier than the crate needs.LINE(words per line) is a generic word under the naming rules and reads better asLINE_WORDS(provisional). The new names join item 1's table. Door: two-way before the move; the names are one-way after it, which is why they go in the ratification table. Effort: S. -
One API inconsistency a stranger meets at once. Finding:
online_cpusreturnsusizewhile every other accessor returnsu64, sotopwritesm.online_cpus() as u64. TheCputype and thecpusfield use the scheduler's word, while the prose says "core" in the module documentation, onCpu, ononline_cpusand in every accessor's summary. The vocabulary rule keepscpufor the unit the scheduler runs a thread on andcorefor the physical core. The page counts the former. Evidence:crates/machine_statistics_contract/src/lib.rslines 4, 147, 274 to 308;crates/top/src/lib.rsline 108. Change: keepusize(a count that indexes an array is std'susize) and say so in one sentence, or returnu64like its neighbors; the maintainer decides. Say "cpu" where the prose means the scheduler's unit. Door: two-way (before the move). Effort: S. -
Documentation a stranger reads, beyond the citations of item 3. Finding, six parts. (a) The BUGS line reads "
vmstatprintsmicrosecondsandsyas one": a unit sweep rewrote theuscolumn name (user time) as a unit symbol; the design note still saysus. (b) Words 6 and 7 of the header line and of every cpu line are reserved and read zero. Nothing says so or says what a later writer may put there.current_cpu_contractstates its growth rule and this crate states none. (c)TICK_HERTZhas no reader in the tree (vmstatdivides by uptime instead), and nothing says what it is for. (d)readdoes not say why its loads areRelaxed(item 5). (e)passive_voicecounts six passives in 2,153 words, two over the template head's allowance;prose_acronymsrefusesPRat line 34. (f) The BUGS section describes one kernel: how its tick samples the run queue, that its switch count is a tick old, that its filesystem is a program. A contract's BUGS section says what the contract cannot express. Evidence:crates/machine_statistics_contract/src/lib.rslines 11 to 17, 34, 80 to 120, 88 to 89;notes/machine-statistics.md"Limits". Change: writeus. Document the reserved words and the growth rule Decision 1 settles. SayTICK_HERTZlets a reader turn tick counts into time without a clock. Add two sentences atread. Put two sentences into the active voice and expand "pull request". Rewrite BUGS as the contract's limits (no consistency across words, no user and system split, a sample's age bounded by the writer's tick and not by the page, a fixed line count). Door: two-way. Effort: S.