1076. address_space_layout: what an outside maintainer would fix before it leaves
Raised by a read-only review of crates/address_space_layout at nife commit 137639a3, as a
stranger meeting the crate in a repository of its own would. It changes nothing; it lists what the
move lane and the lanes after it change.
The crate's review package, notes/crate-reviews/address-space-layout.md, holds the settled
baseline. This block treats as settled only what a ruling elsewhere already fixed. That is the interface identity
(INTERFACE_ID 2 and VERSION 1, from milestone 956 (the linked interfaces carry checkable
versions)), the ratified MAXIMUM_STACK_PAGES and the band numbers themselves (§171 (where a
program image starts), option D). It also includes the placement of this crate at step 3 of
milestone 1017 (the contract crates leave in this order), after the linker-script test moves. Every other name in the crate is
provisional by its own Name: block or carries none.
Reuse: the template partsfoundry/crate-workflows and its scaffold, Kani, cargo-mutants, the template's
name helpers, and the move shape jh7110_entropy and file_allocation_table already took. No new
tool.
Goal
A stranger who finds the crate in its own repository can tell in one screen what it is for. The stranger can build, test and prove it from the README alone. The stranger can place a page with the compiler checking the whole window and not only its first page. The repository's gates are green for the crate's own reasons.
nife consumes it by rev with every pin moving together, and loses no check it runs today.
What was checked, and how
The tools run, the sources read and what was not run are in the appendix.
The items
Effort: S is half a day for a lane or less, M a day or two, L more. A door is one-way when somebody
outside the repository acts on it after the first tag (a public name, a published behavior, a layout, an identity, a dependency). Everything else is two-way, and the maintainer decides it.
Line numbers are from crates/address_space_layout/src/lib.rs at 137639a3 unless a path says
otherwise.
P0: blocks the move
-
The host test reads a file outside the crate. Finding:
the_user_linker_script_links_at_the_image_basedoesinclude_str!("../../user_mode_runtime/link.ld"), so the crate's test target compiles only inside nife's tree. Standing alone it fails at compile time before any test runs. Evidence:src/lib.rsline 358; the standalone build above. Milestone 1017's blocker table names this row with the same resolution. Change: invert the test.user_mode_runtimestays in nife and already depends on the crate, so the test moves there and parses its ownlink.ldagainstaddress_space_layout::IMAGE_BASE_VIRTUAL_ADDRESS. TheIMAGEband's doc comment (line 111) stops promising "a host test here holds the two to the same number" and says where the test lives. Door: two-way. Effort: S. -
The falsification records and patches carry nife's tree paths. Finding: every harness record reads
`crates/address_space_layout/falsifications/<harness>.patch`where the template requires`falsifications/<module>.<harness>.patch`, and every patch's diff header namesa/crates/address_space_layout/src/lib.rs, whichgit apply -p1cannot resolve in the crate's own repository. The template'sfalsify.py --checkreports "replayable with no patch path" for all nine, and the replay would fail every patch as stale. Evidence:src/verification.rslines 53, 74, 99, 110, 123, 133, 146, 156 and 171; the nine files undercrates/address_space_layout/falsifications/; the--checkrun above. Change: in the move commit, rewrite the nine record lines and the eighteen path lines (two per patch header) to crate-relative form, and run the template'sfalsify.pyonce without--check, so each patch visibly turns exactly its own harness red. The patch headers' "Expected to fail" paragraphs need no change. Door: two-way. Effort: S. -
The manifest does not stand alone. Finding:
publish = falsewith a comment pointing atcrates/publish-allowlist.txt;license.workspace = true;[lints] workspace = true; norust-version; nodescription,repository,readme,keywordsorcategories. The template'sstandalone.pyrefuses workspace inheritance, a missingrust-versionandpublish = falseon a crate that means to release. The crate'sCargo.tomlcomment cites milestone 206 (A program image has under 896 KiB, and the failure names an overlap rather than a size) and §171 as nife paths. Evidence:crates/address_space_layout/Cargo.tomllines 5 to 6, 8 to 13 and 15 to 16. Change:license = "MIT OR Apache-2.0",rust-version = "1.87"(the lowest the 1.85 failure allows; the template's weeklymsrvjob will confirm the exact floor), and the three template lints inline (unsafe_op_in_unsafe_fn,missing_docs,unexpected_cfgsnamingcfg(kani)), a one-linedescription,repositoryandreadme. Keeppublish = falsewith a one-sentence comment a stranger can act on ("stays until the release that publishes"), since a separate ruling holds publication and this block does not reopen it. Door: two-way, apart from publication, which is already ruled. Effort: S.
P2: later
The P2 items are in the appendix.
P1: before the tag
The P1 items are in the appendix.
What the move needs in nife
Twenty-seven manifests depend on the crate by path, all but jig/Cargo.toml with
version = "0.1.0"; page_tables as a development dependency. Under §305 (git dependencies on nifeos/* only, pinned to a
landed commit) each becomes
address_space_layout = { version = "0.1.0", git = "https://github.com/partsfoundry/address_space_layout", rev = "<landed commit>" },
the form components/Cargo.toml already uses for jh7110_entropy and e1000e. Milestone 1017 rules
one revision per contract per image, so all twenty-seven move in one pull request, and recommends a
root [workspace.dependencies] entry so the next bump touches one line. For memory_region_heap
(crates/memory_region_heap/Cargo.toml line 21), whose default heap base is the map's HEAP.start,
the same line applies. cargo xtask std-src also copies src/lib.rs into std, and it finds the file through cargo metadata, so it reads Cargo's git checkout once the pins land. The crate leaves crates/publish-allowlist.txt's rule by gaining
its row, and the root Cargo.toml's member list drops it.
Prior art
The comparison with nearby work is in the appendix.
Decisions for the architect
The architect ruled the crate's name and cleared the review package, which ratifies the names of
items 7, 9, 15 and 17, the whole-window check window among them.
The crate's name
Decision N1, option A, 2026-11-14 (UTC): the crate is address_space_layout, in code and as the
package name, with no package = rename and no doc(alias) of the earlier spelling. The rule in
force: nife's vocabulary rule sets map aside where the kernel uses it as a verb, and "layout" is
the word the crate already uses for itself. This tree carries the rename, and the crate's Name:
block says ratified.
A whole-window check, and its name
Background. The three band functions check one page (item 9). The block channel is an 8 MiB window
in SERVICE_WINDOWS; the scratch window in process_builder is 64 MiB in RUNTIME_WINDOWS. Both
are correct today because somebody counted. The crate's BUGS says the check cannot see a window run into the next band. Band::holds(start, end) is the public whole-range check, so the fix
is a const fn that asserts it and returns the start, so the compiler checks a window's size where its address sits. A new public function is a name, and after the first tag it is permanent.
Recommendation: one function, not three:
pub const fn window(band: Band, start_virtual_address: u64, bytes: u64) -> u64, asserting both
arguments page aligned and band.holds(start, start + bytes), so a caller writes
window(SERVICE_WINDOWS, 0x5000_0000, 8 << 20). The three existing functions stay as the one-page
form (or become one-line wrappers over window with PAGE_BYTES). The alternative, three siblings
(pair_window, runtime_window_span, service_window_span), triples the surface and repeats the
copy-and-paste shape whose slip one falsification patch already demonstrates (service_window
checking HEAP). Keeping the one-page functions means no caller changes.
Prior art: vm-memory checks a region's range against its neighbors once, as data, when the code builds the memory. nife checks at the use site, at compile time, which is the design choice §171 made.
Concrete example: crates/process_builder/src/lib.rs lines 51 to 54 builds SCRATCH_WINDOW from two runtime_window calls, one for the start and one for the end. With window it is one call that also proves the 64 MiB between them lies in the band.
Decided by the maintainer on 2026-11-14 (UTC), and the name ratified by the review clearance of
2026-11-21 (UTC). The crate gains one function,
pub const fn window(band: Band, start_virtual_address: u64, bytes: u64) -> u64, which asserts
both arguments page aligned and band.holds(start, start + bytes) and returns the start. The three
one-page functions become one-line wrappers over it with PAGE_BYTES, and their callers do not
change. Item 9 is the work.
Clearing the review package
Background. Before a crate leaves this tree, calef reads its code and its review package and clears it; the clearing is also the approval to create its repository. This crate fixes where every program's image, stack, heap and service windows sit in its address space, and the kernel, the program builder and the runtime all read it. Its review package lists every public name with its state, including the provisional names of items 7, 9, 15 and 17. This decision is the clearing of that package.
Decision, option A, 2026-11-21 (UTC): the architect cleared the review. That approves creating
partsfoundry/address_space_layout and moving the crate with publish = false, no tag and no publish.
The clearance ratifies the names of items 7, 9, 15 and 17 as the package proposed them, window
included; VERSION and INTERFACE_ID stay provisional.
- A. Clear the review once the package lands, which approves creating the repository and moving the crate.
- B. Clear it with named changes to the provisional names, which land in the move pull request.
- C. Send the package back, naming what to change first.
Door: one-way. A public repository is an outward step, and after the first tag every band and name in the crate is what an outside caller builds against.
Prior art. FreeBSD fixes its user address space in machine headers (USRSTACK, SHAREDPAGE),
kept in the kernel's own tree. nife differs in that the layout leaves
the kernel's tree as a crate of its own, pinned by commit, with the compiler checking each window
against its band. Example: block_roster_contract had its clearance on 2026-11-09 (UTC) and now
lives in a repository of its own, which nife pins at the commit of a pre-release tag.
Done when
The checks are in the appendix.
Finding status
One line per finding, in the review's order. Each state was read against
partsfoundry/address_space_layout at 02d497b, its main, where check run 44924529322 and proofs
run 44924529336 are green.
- P0 item 1, the host test reads a file outside the crate: Done, #3659; the test lives in
user_mode_runtime. - P0 item 2, falsification records carry nife's tree paths: Done, #3895; the records and patches
are crate-relative, and
proofs / falsifyreplays all eleven red. - P0 item 3, the manifest does not stand alone: Done, #3659.
- P1 item 4, documentation addressed to a reader inside nife: Done, #3659.
- P1 item 5, no README, licenses, changelog or scaffold: Done, partsfoundry/address_space_layout#2, which records the first stranger run and closes the five README gaps it found. #3659, #3886 and #3895 brought the rest.
- P1 item 6, parameter and helper names the template refuses: Done, #3659.
- P1 item 7, address and length constants: Done, #3886; names ratified 2026-11-21 UTC.
- P1 item 8, the crate's name: Done, #3593; ruled 2026-11-14 UTC.
- P1 item 9, a whole-window check: Done, #3659;
windowratified 2026-11-21 UTC. - P1 item 10,
constassertions under Kani's toolchain: Done, #3659. - P1 item 11, the surviving mutant's exemption: Done, #3886 and #3895; the crate's
.github/mutants-exemptscarries it. - P1 item 12, the layout is the same in every process: Done, #3659.
- P2 item 13,
register_names.pymisreads harness names: Done, #3896; the harnesses sayvirtual_address, andcheck / standaloneis green. - P2 item 14,
BANDSfixes the band count in its type: Done, #3659. - P2 item 15, a caller can build
Bandinverted: Done, #3886. - P2 item 16,
#![forbid(unsafe_code)]: Done, #3659. - P2 item 17, nife's checks that walk
crates/lose this crate: Done, #3886 (page_tablestests its split shifts) and #3895; the declarations check reads interface id 2 from the pinned checkout. - P2 item 18, milestone 1017's stale blocker row: Done, #3635.
- The move and nife's pins: Done, #3895; all twenty-seven manifests name one
rev.
Publishing is not a finding: no first publish happens until the last outside-review milestone closes (ruled 2026-11-18 UTC).
Open decisions
None.
Follow-on
- Done. The crate lives in
partsfoundry/address_space_layout, and nife pins it byrev. - Outstanding. The first full
mutationrun onmain, which the done-when list asks for. The one scheduled run so far deferred itself and ran no mutants. Only the publishing hold stands behind it.
BUGS
- The 1.88 floor is the lowest installed toolchain that builds the crate (1.85 fails on
is_multiple_of), and 1.87 refuses it; the weeklymsrvjob is the check. - The crate's first full
mutationrun is the scheduled one; none has run yet.
Index row
An outside review of address_space_layout before it leaves nife found three findings that stop a standalone build (a test reading a file outside the crate, falsification records in nife's path form, a manifest that inherits from the workspace). It found nine to land before the first tag and six for later. The crate's own name has its ruling and its rename. The architect cleared the review package, and the constants carry their ratified names, the whole-window check window among them.