1100. memory_region_heap: what an outside maintainer would fix before it leaves
Raised by a read-only outside review of crates/memory_region_heap as a stranger meeting it for
the first time would. It changes nothing; it lists what the next lanes change. The number is the
recording lane's to assign.
The review took its baseline from notes/heap.md ("The memory_region_heap crate's contract"),
from milestone 1017 (the contract crates leave in this order), step 9 and its appendix on where
talc goes, and from the vendoring record in vendor/README.md and vendor/talc.pin. It raises none of the decisions those settle. Those are the algorithm (talc 5.1.1's core, Manual source), the geometric growth with a floor of eight pages and the one contiguous heap. They also include the untyped slot as part of the program's capability contract, and the step at which the crate leaves. The review package is
notes/crate-reviews/memory-region-heap.md.
Reuse: the template partsfoundry/crate-workflows and its scaffold, script/crate-standalone,
script/crate-review-packet, helpers/name_release.py, cargo-mutants, Kani, and the std farm's
copied-file list (xtask/src/farm/copied.rs). No new tool.
Finding status
- P0-1, names and the missing
Name:blocks: Done, #3597. The names later items added are ratified (ruled 2026-11-19 UTC). - P0-2,
talcand the path dependencies: Waiting on repositories formoho_abianduser_mode_runtime. Thetalchalf follows Decision B, and the README's BUGS section states what crates.io's 5.1.1 lacks (#3840). The manifest pinsaddress_space_layoutbygitandrev(#3895);moho_abianduser_mode_runtimehave no repositories yet, so the manifest keeps their path dependencies, andscript/crate-move --dry-runfails only on them. - P0-3, manifest, README and license files: Done, #3840. The manifest states its license,
rust-version, description, keywords, categories and lints, both license files sit beside it, the README's host example runs as a doctest, and the crate's documentation cites nothing outside it. - P0-4, the
vabinding andcommit_all: At the move. The binding andcommit_allare done in #3597, and the fuzz workspace's binding in #3840. The coverage half is the move's: the template'scoveragejob first measures the host tests after the move. - P1-5, a second
initialize: Done, #3559. - P1-6, a grow of zero bytes: Done, #3559.
- P1-7, kernel refusals read as budget spent: Done, #3609.
- P1-8, page-source seam, host tests, proofs and one copy of the policy: Done, #3609 and
#3840. The seam, host tests and three harnesses landed in the first; in the second the
growth arithmetic lives in the core-only
src/growth.rs, whichcargo xtask std-srccopies into std asheap_growth.rs, andsecond_mountruns onMemoryRegionHeapover a host page source. The fuzz target keeps a copy, because it reads talc's counters, and its README says so. - P1-9, documentation and the minimum cap: Done. The crate documentation landed in #3609, the README in #3840.
- P2-10,
PAGE_BYTES: Done, #3609. - P2-11, a panic inside the allocator: Done, #3609.
- P2-12, growth is monotonic: Done, #3840. The crate documentation and the README say so, and the README's BUGS section carries the line.
- P2-13, accessors for the cap and the base: Done, #3609.
- P2-14, the
Syncargument: Done, #3609. - Decision A, the seven names and
commit_all: Done, #3597, ruled 2026-11-14 (UTC), option A. - Decision B, which
talcoutside nife: Done, #3840, ruled 2026-11-14 (UTC), option A. The crate depends on crates.io'stalc5.1.1 with no patch outside nife, and the README says what that release lacks. - Fork
talcif upstream stays silent: Will not fix (ruled 2026-11-25), option A. No fork; the unpatched dependency and the README sentence stay, and nife keeps watching upstream.
Open decisions
Ratify the names the later items added (ruled 2026-11-19 UTC)
The rule in force, option A. The thirteen names the fixes for items 5 to 13 added stand as built:
Short, PageSource, MemoryRegionPages, Refusal, WiringRefusal, base_virtual_address,
maximum_bytes, initialize_source, with_source, is_budget_spent, is_initialized,
last_refusal and map_page. Each public item's Name: block reads ratified. The unpublished
fuzz crate's names (the modules src, policy and sequence and the function run) stay
provisional, since that crate never publishes.
Prior art. dlmalloc names its page seam Allocator, and rlsf names it FlexSource; both
crates settled the name before 1.0. Vec::try_reserve returns a named error type, which is the
shape Short and Refusal follow. nife differs in ratifying every public item, not only the
ones a README shows. Concrete example: a consumer writes
MemoryRegionHeap::with_source(source) and matches Refusal from last_refusal(); those
spellings are what it compiles against.
Fork talc if upstream stays silent (ruled 2026-11-25 UTC)
The rule in force, option A. The crate keeps the unpatched crates.io talc 5.1.1 dependency and the
README sentence that states the gap, and nife keeps watching upstream. nife makes no fork. nife
reconsiders a fork only if a 32-bit target arrives or its maintainer declares upstream abandoned.
Background. The crate's allocator core is talc 5.1.1 from crates.io. nife builds a patched copy
(vendor/talc, carrying upstream pull request 57, two fit-check overflow fixes), but a [patch]
table does not travel with a library, so outside nife the crate builds the unpatched release.
Upstream pull request
SFBdragon/talc#57 has had no comment since 2026-09-24,
and the last upstream commit is 2026-09-09. The overflow needs addresses that wrap at the top of a
64-bit space, so no 64-bit process meets it. nife's images build the patched vendor copy.
- A. Keep the unpatched crates.io dependency and the README sentence, and keep watching upstream.
- B. Fork
talcundernifeos, publish the fork, and depend on it. - C. Replace
talcwith another allocator core.
Door: one-way for B and C (a published crate and a dependency other repositories build); A changes nothing.
Prior art. Rust's std depends on crates.io dlmalloc 0.2 for its wasm targets with no patch,
and takes fixes only through releases. Debian and the BSD ports keep a patch at the distribution,
which is the shape nife's root [patch] has today. A fork is the usual answer when an upstream has
stopped, but here the fix does not reach a 64-bit process, so a fork would add a crate, a repository
and a maintenance duty for no reachable gain. Concrete example: the crate's own repository runs its
host tests against unpatched 5.1.1 and passes, while basalt's image, built in nife's workspace,
links the patched source.
Clear the review package and approve the repository (ruled)
Ruled 2026-11-20 (UTC), option A: the architect clears the package, and the clearance creates the
repository, nifeos/memory_region_heap, with publish = false. No tag and no publish. The move waits for moho_abi,
address_space_layout and user_mode_runtime to get repositories. It leaves on its own clearance, as
one repository with subtree_scope or as a repository of its own, decided at the move (ruled
2026-11-20 UTC), and before redoxfs, which keeps its own track.
Background. A crate leaves this tree for its own nifeos repository only when the architect
clears its review package; that clearance approves the repository. A package lists every public
item with its signature, and script/crate-review-packet writes it. The package for this crate is
memory-region-heap.md, written under the
recommendation below. The
components, the fixtures and the RedoxFS server all depend on it, so it serves several consumers and
meets the bar for leaving.
Recommendation: A. A package written after the names are ratified shows the architect the crate as it will ship.
- A. A lane writes the package; the architect's clearance creates the repository.
- B. Clear on this outside review alone, without a package.
- C. Keep the crate in nife and move it with the runtime package.
Door: one-way. Creating a public repository and moving the crate there are outward steps that other pins then follow.
Prior art. The Rust library team reviews a new std interface through an API change proposal
before it stabilizes, and Fuchsia's API council reviews a library before it enters the SDK (both
recalled, not re-read). nife differs in reviewing a whole crate once, before its first publish.
Concrete example: the architect cleared generational_table on 2026-11-08 (UTC), and its
repository partsfoundry/generational_table dates from that day.
Blocks: the move.
Goal
A stranger who meets memory_region_heap in its own repository can tell in one screen what pays
for the heap, where it lives, how it grows and when it refuses. The same stranger can build and test
the growth policy on a host without a kernel, can read every unsafe block against a stated
invariant that holds, and sees the template's gates green for the crate's own reasons.
How the review checked
The tools run, the sources read and what was not run are in the appendix.
Prior art
The comparison with nearby work is in the appendix.
The items
Effort: XS is under an hour for a lane, S is half a day, M is a day or two. A door is one-way when somebody outside the repository acts on it after the move (a public name, a published behavior, a dependency). Everything else is two-way and the maintainer decides it.
P0: blocks the move or turns the template's first run red
-
Seven names are not ratified, and five public items carry no
Name:block. Finding:script/crate-standalonestep 0 fails on the crate name (provisional) and oninitialize(provisional).DEFAULT_BASE,MemoryRegionHeap,new,commit_allandcommitted_byteshave no block at all, so they never entered the worklist. A crate that leaves is a third-party crate and the move commit strips the blocks, so every name must readratifiedfirst. Evidence:crates/memory_region_heap/src/lib.rslines 11, 29, 54, 80, 98, 119, 128.design/module-block-baseline.txtlines 5190 to 5198.helpers/name_release.py --draft. Change: one lane writes the five missing blocks, brings the seven names to the architect as one table (Decision A below carries the recommendation), and applies the ruling. Door: one-way (public names). Effort: S plus the ruling. -
The
talcdependency does not survive the move as written, and three path dependencies point into nife. Finding: the manifest asks crates.io fortalc = "5.1.1"and relies on the nife workspace's[patch.crates-io]to buildvendor/talc, which carries upstream pull request 57 (two fit-check overflow fixes; the first fixes undefined behavior that Miri reports). A[patch]table applies only in the root workspace, so a repository of the crate's own, and every workspace that consumes it without the patch, silently builds the unpatched package. The pull request has been open for seven weeks at the time of the review with no maintainer comment, which is a reliability signal for the upstream.moho_abi,address_space_layoutanduser_mode_runtimeare path dependencies. The order of milestone 1017 moves them at steps 2 and 3, before this crate at step 9, so their repositories will exist, and the lines becomegitandrevpins withversionbeside them. Evidence:crates/memory_region_heap/Cargo.tomllines 19 to 28.vendor/talc.pin.design/roadmap/1017-the-contract-crates-leave-in-this-order.md, "Wheretalcgoes at step 9". Change: Decision B below. Whatever the ruling, the move lane states in the README whichtalcthe crate builds against and what the unpatched package lacks. Door: one-way (a dependency). Effort: S. -
The manifest and the files a stranger needs. Finding: no README, no
LICENSE-MIT, noLICENSE-APACHE, norust-version,licenseandlintsinherited from the workspace, nodescription,repository,keywordsorcategories. Thepublish = falsecomment points atcrates/publish-allowlist.txt, a file that is not in the crate's repository. The crate docs linknotes/heap.mdby path. The manifest comment names the architect and a decision section. Evidence:Cargo.tomllines 2 to 28.src/lib.rsline 2.script/crate-standaloneoutput, 15 of its 16 failures. Change: fill in the scaffold'sREADME-crate.md(what pays, where it lives, how it grows, the minimum useful cap, what a null return means, thetalcit builds against). Add both license files, an explicitlicense = "MIT OR Apache-2.0"and arust-version. Write a manifest comment a stranger can act on. The license and the version policy are already ruled for every crate that leaves. Nothing here reopens them. Door: two-way (the license is one-way and already ruled). Effort: S. -
The template's
checkworkflow goes red on the first pull request for the crate's own reasons. Finding: two naming helpers fail at the template's ceiling of 0. The local bindingvais on the spelled-out list (virtual_address), andcommit_allreturnsboolthrough a shared reference, whichquestion_shapereads as a getter with a question's answer. nife holdscommit_allindesign/naming-rule-baseline.txt. The template has no baseline. Separately,[lib] test = falseanddoctest = falsemean thetestsjob runs nothing. Thecoveragejob floors each file at 85 percent of lines covered. With no test binary the report is either empty or showssrc/lib.rsat zero (unverified which). Either reads as a red or a vacuous green. Evidence:src/lib.rslines 119 and 165.Cargo.tomllines 11 to 14. The template'shelpers/spelled_out.py,helpers/question_shape.py,helpers/coverage-floor.sh. Change: rename the binding tovirtual_addressnow (XS). Forcommit_all, Decision A carries the recommendation. For the tests, item 8 is the real fix. Until it lands, the move lane either exemptssrc/lib.rsin.github/coverage-exemptionswith the stated reason ("every path ends in a system call; tested under QEMU") or lands item 8 first. Door:vais two-way.commit_allis one-way (a public name). Effort: XS, plus item 8.
P2: later
The P2 items are in the appendix.
P1: before the tag
The P1 items are in the appendix.
Decisions for the architect
The architect ruled both one-way doors. No decision stays open.
A. The seven public names, and the shape of commit_all (ruled 2026-11-14 UTC)
The rule in force, option A (block 1100 decision A):
memory_region_heap,MemoryRegionHeap,initialize,committed_bytesandneware ratified as they stand. Each public item carries aName:block that reads ratified.DEFAULT_BASEisDEFAULT_BASE_VIRTUAL_ADDRESS, under the rule that an address is_VIRTUAL_ADDRESSor_PHYSICAL_ADDRESSin every location.commit_allkeeps its name and returnsResult<(), Short>, whereShortcarries the bytes the heap could not commit.Shortis provisional. The one caller, the shell'sinitialize_heap, discards the value withlet _ =.maximum_bytesandbase_virtual_addressare the two accessors of item 13. Both are provisional.- The local binding
vaisvirtual_address(item 4).
Prior art. Vec::try_reserve returns Result<(), TryReserveError> for exactly this shape: act,
and say how it failed. std_runtime_contract::HEAP_BASE is the same value as the heap's default
base under another spelling; the move is the moment to make the two agree or to make one defer to
the other. address_space_layout::HEAP.start is where both come from.
B. Which talc the crate builds against outside nife (ruled 2026-11-14 UTC)
The rule in force, option A (block 1100 decision B):
- Outside nife the crate depends on crates.io
talc = "5.1.1", unpatched. - The crate's README, written by the move lane, states what the unpatched package lacks (upstream pull request 57's two fit-check overflow fixes) and why a 64-bit process does not reach it.
- nife's root
[patch.crates-io]keeps applying to nife's whole graph, this crate included. redoxfscarries its own patch file, as the step 9 appendix of milestone 1017 rules.- When a
talcrelease carries the fix, the crate bumps and the README sentence goes. - nife reconsiders a fork only if a 32-bit target arrives or its maintainer declares upstream abandoned. A fork under
nifeosneeds its own approval. Ruled 2026-11-25 (UTC): no fork now.
The evidence, background, prior art and the options not taken are in the appendix.
Follow-on
- Outstanding. The move, which leaves on this crate's own clearance, with
subtree_scopeor alone, and beforeredoxfs. The path dependencies becomegitandrevpins oncemoho_abianduser_mode_runtimehave repositories, checked incrates/memory_region_heap/Cargo.toml. The move drops the fuzz workspace's[patch.crates-io]line for the vendored talc, and the template'scoveragejob then measures the host tests for the first time.
Done when
The checks are in the appendix. Each item's state is under "Finding status" above.
BUGS
- The template's
coveragejob has not run on the crate; its 85 percent floor is unmeasured against the 16 host tests and the README doctest. - The fuzz target drives a copy of the policy, so a change to the crate's policy that the copy misses goes unchecked there.
- The page cost of a refused
MAPat an already-mapped address comes from the kernel's own comment (kernel/src/system_call/memory_region.rsline 72), not from a run. - The minimum first-heap figure (1,575 bytes) comes from a hand computation over
DefaultBinning's bit field ([usize; 3],BIN_COUNT = 191) and talc'smin_first_heap_size;the_first_heap_fits_in_one_pagepins it. - Whether the unpatched
talc5.1.1 fit-check overflow can occur in a 64-bit process comes from reasoning over the patch, not from a proof. Decision B states it as practice, not as a theorem. - The mutation census groups this crate with two others; no per-crate figure exists to report, and nobody ran one.
- The review did not run
cargo-semver-checks(no previous release), Miri, the QEMU suite or a release dry run.
Index row
An outside review of memory_region_heap before it leaves. Every code and documentation fix has
landed: a page-source seam, host tests, three Kani harnesses, one copy of the growth arithmetic that
std generates from, a README and both licenses. What remains is the move: path dependencies that
become pins once their crates leave, and clearing the review package.