P0: blocks the move or any publish
An appendix to the milestone.
-
MappedWindow::read<T: Copy>andwrite<T>let safe code read or write any type at any offset. Finding:readispub fn read<T: Copy>(&self, off: u64) -> Toverptr::read_volatile. The only check is the byte range.Tmay be&'static u8,bool,char, a fieldless enum, a function pointer or aNonZeroU64. A window holding the bytes a device or peer wrote then produces a value with an invalid bit pattern from a safe call, which has undefined behavior. The same call withT = u64atoff = 1is an unaligned volatile read, whichread_volatiledocuments as undefined behavior; ther64doc says "the caller keeps the offset 8-aligned", which a safe function cannot ask.write<T>carries no bound at all. Every caller in the tree passesu8,u16,u32oru64, so no current program is wrong. The hole is in the claim the signature makes. An outside reviewer of anunsafe-heavy crate looks for it first. Evidence:src/mapped_window.rslines 83 to 97 (read,write), 123 to 132 (r64,w64), 75 to 81 (check). Change: a sealed trait for the integers the window carries (u8,u16,u32,u64, and their signed twins if a caller wants them), with a private supertrait so no one outside the crate implements it;read<T: Word>andwrite<T: Word>. Extendcheckwith an alignment check:(self.base + off) % align_of::<T>() == 0, panicking with the offset and alignment named, as the bounds panic does. Prior art:tock-registerssealsUIntLike;zerocopyandbytemuckexpress the same promise asFromBytesandPod;volatile-registerandvcellavoid the question by reading through&selfon a typed place. Concrete example: todayWINDOW.read::<&u8>(0)compiles and has undefined behavior. After the change it does not compile, andWINDOW.r64(1)panics instead of causing undefined behavior. Door: two-way now (every caller already uses an integer type); one-way after the first tag, because narrowing a generic bound is a breaking change. Effort: S. -
doorbell_barrierandvirtual_io_ring_barriertell the compiler they are not barriers on aarch64 andx86_64. Finding: thedmb sy,dmb ishandmfencearms carryoptions(nomem). The Rust reference says ofnomem: "The assembly code does not read from or write to any memory accessible outside of the assembly code. This allows the compiler to cache the values of modified global variables in registers across execution of the assembly code ... The compiler also assumes that the assembly code does not perform any kind of synchronization with other threads, e.g. via fences." So on two of three architectures the compiler may move an ordinary load or store across either barrier. The riscv64 arm omitsnomemand its comment says why ("ordering memory is its job"); the two other arms contradict it inside the same function. No one knows of a miscompile. Every current caller pairs the barrier with volatile accesses on both sides, and the bulk copies carry their owncompiler_fence. A caller that writes throughas_mut_sliceand then rings a doorbell is the exposed shape, and theSAFETYcomment ("cannot be unsound; it only constrains ordering") is false as written. Evidence:src/mapped_window.rslines 253 to 266;src/virtio.rslines 81 to 84. Change: deletenomemfrom the four arms, keepingnostackandpreserves_flags, and say in each comment that the absence ofnomemis the compiler half of the barrier. Prior art: the Linuxdmb()andmb()macros carry a"memory"clobber, which is what anasm!block withoutnomemis in Rust. Concrete example: a driver that fills a descriptor throughas_mut_slice, callsdoorbell_barrier, then stores the tail register: withnomemthe compiler may sink the descriptor stores past thedmb; without it the order holds. Door: two-way. Effort: XS. -
The manifest and the files the standalone check refuses. Finding:
script/crate-standalonefails the manifest and files steps. The crate inheritslicenseandlintsfrom the nife workspace. It has norust-version, no README, noLICENSE-MITand noLICENSE-APACHE. Thepublish = falseline points atcrates/publish-allowlist.txt, a file the crate's repository does not hold. The[lints]the template'sstandalonejob requires (unsafe_op_in_unsafe_fn,missing_docs,unexpected_cfgsnamingcfg(kani)) need literals in the manifest. The entry macro'scfg(kani)arms depend on the last one. The manifest has nodescription,repository,keywordsorcategories.jig/Cargo.tomldepends on the crate by path with noversionkey, which the move'srevform needs. Evidence:Cargo.tomllines 5 and 6, 16 and 17; the standalone check's output; the scaffold'sREADME-crate.md. Change: the move lane's ordinary work, which it does in nife before the move so the move commit stays mechanical. Write a literallicenseand a literal[lints], and addrust-version. Add a README from the scaffold with the build lines for all three targets, and both license files. Reword thepublishcomment to one sentence a stranger can act on. Addversionon jig's dependency line. The six path dependencies the check also reports are the extraction order of milestone 1017 (the contract crates leave in this order) doing its job, not a defect:abi,clock_contract,counter_frequency_contract,current_cpu_contract,entropy_contractandsocket_contractleave first. Door: two-way (the crate name and the license are already ruled). Effort: S. -
The crate has no test target, and the template's required checks assume one. Finding:
[lib] test = false, bench = false, doctest = false, with the reason "aarch64-only inline asm, so no host test". The crate hasx86_64arms for every instruction and builds on anx86_64Linux host (verified), and its aarch64 arms are valid on an aarch64 host. The template'scheck / tests,check / coverage(85 percent per file) andcheck / mutation-diffrun on the host; a crate with no tests gives the first nothing to run, the second nothing to measure, and the third a suite that kills no mutant. The mutation-testing notes already record that shape for a crate that reaches this one. Meanwhile theshould_panicexample inmapped_window.rsand the twoignoreexamples inprocess.rsare never compiled, and milestone 1017 says thelink.ldtest now inaddress_space_layout"moves touser_mode_runtime", which needs a test target to move into. Much of the crate is pure logic that runs anywhere: the window's bounds and alignment checks and its three copies,Frame's accessors over a heap page,Delivered::decode's four branches, the three hand-assembled stubs, and the nanosecond conversion. Evidence:Cargo.tomllines 8 to 14;src/mapped_window.rslines 29 to 33;src/process.rslines 88 to 92 and 114 to 126. Change: turntestanddocteston. Factormonotonic_nanosecondsinto a pureticks_to_nanoseconds(ticks, hertz)and test its overflow edge (the five-minute wrap the doc names). TestMappedWindowandFrameover a#[repr(align(4096))]heap page: bounds, the new alignment check,sub,copy_withinwith overlap,copy_to_slice,copy_from_slice. TestDelivered::decodeon all four branches andReceivedon both. Decode eachmovz,addiandmov r32, imm32inchild_stubback to theabiconstant it should carry (item 7). Move thelink.ldbase test here. Gate everything that traps or reads a system register behindcfg(target_os = "none")or leave it untested and list those files in the coverage exemptions file the template reads, each with its reason. Turn theignoreexamples intono_runso they compile. Reword the manifest comment. Door: two-way. Effort: M. -
Nine build scripts in nife reach
link.ldby a relative path into this crate's directory. Finding:components,fixtures,jig,redoxfs_server,std_exerciser,cryptography_exerciser,pinned_tls_exerciser,mdrandc_libraryeach pass-T<manifest dir>/../crates/user_mode_runtime/link.ldto the linker, andaddress_space_layout's test doesinclude_str!("../../user_mode_runtime/link.ld"). After the move the file is in a dependency's source directory, which a consumer's build script has no path to. The script is interface 20, "the entry registers and link layout a program starts with", so it belongs with the runtime; what is missing is a delivery mechanism. Evidence:jig/build.rslines 9 and 10;components/build.rsline 21;crates/address_space_layout/src/lib.rsline 358; the dry run's nife-side list. Change: abuild.rsin this crate that copieslink.ldintoOUT_DIRand printscargo:rustc-link-search=<OUT_DIR>, withcargo:rerun-if-changed=link.ld. A consumer then passes-C link-arg=-Tlink.ldwith no path, from its build script or its.cargo/config.toml. Prior art:cortex-m-rtandriscv-rtshiplink.xexactly this way, and every embedded Rust binary links with-Tlink.x. Concrete example:jig/build.rsloses its two path lines and gainsprintln!("cargo::rustc-link-arg=-Tlink.ld"). Theaddress_space_layouttest moves here (item 4) and reads the file byinclude_str!("../link.ld"). Door: two-way untildisk-toolsleaves, as Decision 2 decides, provisionally. Effort: M, counting the nine consumers.