P2: later
An appendix to the milestone.
P2: later
-
check_backupdemands a layout the specification does not. DONE for the documentation alternative (check_backupsays it is stricter than the specification and why). The strictness stays. Finding: the backup'sentry_array_lbamust equalalternate_lba - entry_array_blocks()exactly. UEFI 2.10 section 5.3.1 says "The backup GPT Partition Entry Array must be located after the Last Usable LBA and end before the backup GPT Header", which allows slack. Linux reads the backup array from the backup header's own field; FreeBSD too. Whether any tool writes slack no source confirms it;sgdiskanddiskutildo not (the fixtures). Evidence:src/table.rsline 245 tosrc/table.rsline 247;src/error.rsline 92 and:93. Change: acceptlast_usable_lba < entry_array_lbaandentry_array_lba + array_blocks <= alternate_lba, keepbackup_entry_lba()as the convention the writer uses, and rewordBackupMismatch::EntryArrayLba. Or keep the strictness and say in the documentation that it is stricter than the specification and why. Door: two-way. Effort: S. -
The proofs stop short of the hostile-input surface. PARTIAL. DONE: the four harnesses, each with its patch (
the_protective_master_boot_record_check_is_totalinmaster_boot_record,a_span_always_contains_what_was_asked_for,a_name_always_decodes_into_its_documented_buffer, andthe_header_checks_before_the_crc_are_totalwiththe_header_crc_in_pieces_is_the_crc_of_the_whole), and the three that makeparsetotal on a 512-byte block and a one-entry array (the_entry_array_check_is_total,the_table_checks_are_total_on_one_entry,the_partition_checks_are_total_on_one_entry). LEFT: the fuzz target moves with the crate. Finding: eight harnesses prove the codecs, the CRC's structure at eight bytes, the overlap rule and the writer against the reader's rules. Five properties are not proved. First, thatHeader::decodeis total on any block (the package's open question 1; the CRC chain is what makes it costly). Second, thatmbr::validateis total on any 512 bytes (no CRC, so cheap). Third, thatSpan::coveringcontains what the caller asks for on allu64s (pure arithmetic; the testa_span_always_contains_what_was_asked_foralready states the property over a grid). Fourth, thatEntry::name_utf8is total over 36 symbolic code units. Fifth, item 2'sblocks. The fuzz target is the only machine check ofparseon hostile bytes and it runs in nife's workspace, not the crate's. Evidence:src/verification.rs;src/span.rsline 129 tosrc/span.rsline 148. Change: add four cheap harnesses (mbr::validate,Span::covering,name_utf8,blocks), each with a patch. ForHeader::decode, try the two-stage form the header round trip already uses rather than the whole function. That form proves the checks before the CRC total on a symbolic block, and the CRC's piece-wise form equal to the whole on short inputs. Then move the fuzz target under milestone 1043 (A moved crate is fuzzed in its own repository) and opt the repository in (nounsafe, so eligible). Door: two-way. Effort: M. -
Debugon a table prints the entry array. DONE (a_table_debug_prints_a_summary_and_every_refusal_is_an_error). Finding: the derivedDebugprints the 16 KiBentriesslice: 49,513 characters for the sample disk (measured). A stranger's first{:?}floods a console or a kernel log. Evidence:src/table.rsline 12 tosrc/table.rsline 19. Change: a hand-writtenDebugwith the header, the block size and the count of used entries. Door: two-way. Effort: XS. -
Two casts narrow on a 32-bit host without saying so. DONE (
Span::coveringrefuses an offset ausizecannot hold andcreaterefuses an array whose count does not fit au32). No host test reaches either on a 64-bit host. Finding:Span::coveringreturnsoffset as usize(src/span.rsline 61), which truncates whentransferexceedsusize::MAXon a 32-bit host, whilebuffer_bytesthree lines down guards the same case;createcomputes(entry_array.len() / entry::SIZE) as u32(src/table.rsline 158), which truncates for an array over 512 GiB. Neither is reachable in practice, and the README's claim that every arithmetic edge has a check carries these two asterisks. Change:usize::try_from(offset).ok()?andu32::try_from(...)withError::EntryArrayShape. Door: two-way. Effort: XS. -
The crate checks the header's reserved tail but not the entry's, and not the attribute bits. DONE (the crate root states which "must be zero" rules the reader enforces). Finding:
Header::decoderefuses a non-zero byte after the header (UEFI: "The rest of the block is reserved by UEFI and must be zero"), the strictest check in the crate.Entry::decodereads the first 128 bytes of a larger entry and ignores the rest, which the specification also says "must be zero"; attribute bits 3 to 47 "must be zero" and are not checked. The asymmetry is a choice the documentation does not state. Evidence:src/header.rsline 108 to:110;src/entry.rsline 12 to:15;src/entry.rsline 60 to:62. Change: one paragraph in the crate root saying which "must be zero" rules the reader enforces and which it tolerates, and why (the header's tail protects the CRC's meaning; an entry's tail and its reserved bits protect nothing this crate reads). Or enforce both and record the first real disk that trips them. Door: two-way. Effort: XS. -
A header that declares more than 92 bytes re-emits as 92. DONE (
Header::encode_intosays a rewrite normalizes to 92 bytes). Finding:Headerdropsheader_size;encode_intoalways writes 92. A parsed table from a disk with a 96-byte header passesparse, andwrite_primary_headerthen writes a header the other tool would read as changed. The specification permits the larger size, and no tool writes one that the review knows of (unverified). Evidence:src/header.rsline 22 to:25;src/header.rsline 145 to:158. Change: say so inencode_into's documentation (a rewrite normalizes the header to 92 bytes), which is what a tool that does not know the larger layout should do anyway. Door: two-way. Effort: XS. -
A caller must add
uuiditself to name the type the crate returns. DONE (pub use uuid). Finding:guid::Uuidis re-exported, so a caller can writeguid::Uuid, butUuid::from_fields,Builderand the parsers need the caller's ownuuiddependency at a matching major; nife'suefi_loader/Cargo.tomlcarries that second line.gpt_disk_typesre-exportsuguidandcrcwhole. Evidence:src/guid.rsline 10;uefi_loader/Cargo.tomlline 106. Change:pub use uuid;at the crate root, and the README example writesuse globally_unique_identifier_partition_table::uuid::Uuid. Door: two-way. Effort: XS. -
The MBR validator calls a dead record a hybrid. DONE (
a_typed_record_of_zero_blocks_is_not_a_hybrid). Finding:validaterefuses any record beside the protective one whoseOSTypeis non-zero. UEFI 2.10 section 5.2.1: "A Partition Record that contains an OSType value of zero or a SizeInLBA value of zero may be ignored." A record with a type and a zero size is noise the specification lets a reader skip; here it isMbrProblem::ExtraRecord. No source says whether any tool leaves one. Evidence:src/mbr.rsline 70 to:72. Change: skip a record whoseSizeInLBAis zero before judging it extra, with a test. Door: two-way. Effort: XS.