P2: later
An appendix to the milestone.
P2
-
Error variants the mapper never raises, and a half that does not exist.
MapError::WritableAndExecutable(src/mapper.rslines 39 to 47) comes only from the kernel's mapping hold.MapError::BadRegiononly bydomain::grant_pages. Both live in the enum a stranger reads as the mapper's contract.VtdandAmdVisetSPLIT_SHIFT = 47so thatis_in_halfadmits every physical address under 128 TiB (src/x86_64.rslines 259 to 264,src/x86_64.rslines 380 to 381). A domain over a frame above that getsWrongHalf, an error about a concept IOVAs do not have. Fix: either moveWritableAndExecutableto the kernel (it is the kernel's rule) and documentBadRegionas the domain builder's, or keep both and say so in the enum's doc for the crate's reader. Document the IOMMU formats'SPLIT_SHIFTas a ceiling. Effort S. Two-way until the first release. -
Mapper::walkmisreports a walk longer thanMAXIMUM_WALK. The loop atsrc/mapper.rslines 461 to 487 assignswalk.endin three branches andcontinues in the fourth without assigning it, so a format with six or more levels would exhaust the loop and returnWalkEnd::OtherHalfwith five steps. No such format exists here, and the constant's comment (src/mapper.rslines 491 to 493) says the spare level exists to catch exactly this. Fix: aconstassertionF::LEVELS <= MAXIMUM_WALKinwalk, or aWalkEnd::Truncatedvariant. Effort S. Two-way. -
PageSize::{Size4KiB, Size2MiB, Size1GiB}against the units rule.design/naming.md, "Units", says the IEC binary prefixes are symbols and a name sayskibibytes,mebibytesorgibibytes. The variants (src/page_size.rslines 16 to 23) cite thex86_64crate as prior art, which is accurate (verified:x86_640.15.5 implements itsMapperforSize4KiB,Size2MiBandSize1GiB). The template'sunit_symbols.pyjudges 1,077 names in this crate and refuses none, because it splitsSize4KiBat the digit and never seeskibas one component, so the rule and its check disagree here. Decision 2, under "Open decisions". BUGS records the template gap. -
What a user of the comparable crates will reach for and not find. The crate has no way to change the flags of a live mapping (
x86_64::Mapper::update_flags,pmap_protect). It has nounmap_block, no range walk or iterator, and no reclamation of an emptied intermediate table (the kernel frees frames wholesale).MapErrorhas noDisplayorcore::error::Error.PageTable.entriesispub(src/page_table.rsline 18), so a caller can bypass the format.Flagsderives neitherHashnorOrd. Each is a defensible non-goal for this kernel. Fix: say so in the README's BUGS, and addcore::error::ErrorforMapError, which costs oneimpl. Effort S for the documentation. M for any method. Two-way. -
Documentation that drifted or stops short.
TranslationLookasideBufferFlush::flushnamestlbi vaae1isandsfence.vmaand notinvlpg(src/translation_lookaside_buffer_flush.rsline 22).PageFormat::LEVELSandSPLIT_SHIFTdocument aarch64 and Sv39 only (src/page_format.rslines 55 to 60), andHalf's doc the same (src/page_format.rslines 13 to 16).src/flag_tests.rsline 78 says "the CAP_* bit positions" for constants now namedACCESS_*.src/x86_64.rsline 26 says the PAT reset value was "recalled rather than re-read", which a stranger reads as unverified. Fix: one doc pass. Cite the SDM for the PAT reset value. Effort S. Two-way. -
tests/mapping.rsfrees its tables by an opt-in guard. Its own BUGS (tests/mapping.rslines 35 to 39) says a test that forgetslet _tables = TableGuard;leaks, and twenty-one call sites are not converted to the pool shapetests/blocks.rsandsrc/domain.rsuse, where the borrow checker enforces it. Fix: convert to thePoolshape. Effort S. Two-way. -
The Sv39 device bit is software bookkeeping, and the T-Head values have one source.
SW_DEVICE(src/sv39.rslines 26 to 30) records device memory in an RSW bit the hardware ignores. A machine with Svpbmt would want bits 62:61, which no format here sets.Sv39Mae's memory-type values come from Linux'spgtable-64.halone (src/sv39.rslines 139 to 147). The text cites no vendor document. Fix: say both in the README's BUGS. Name the Svpbmt format as future work. Cite T-Head's document for the MAEE bits if one exists, or say that the search found none. Effort S. Two-way. -
Miri warns on the tests' integer-to-pointer casts.
tests/mapping.rsline 57,tests/blocks.rsline 51,tests/nth_allocation.rsline 50 andsrc/domain.rsline 362 turn aBoxinto au64and back;notes/undefined-behavior.mdline 93 records the warnings as deliberately left. The template's weekly Miri job will print them on every run. Fix:ptr::expose_provenanceandptr::with_exposed_provenanceat those four sites, or a one-line note in the README. Not run under Miri for this review. Effort S. Two-way.