DF-5342 / verdict.json
{ "finding_id": "DF-5342", "status": "untested", "reproduced": false, "impact": "none", "confidence": "likely", "verdict": "Defect is certain at code level; decision divergence proven on the audited guest. mptable_lapic_pass1_callback() accumulates the HT-fixup APIC-id mask in a u_int: ht_apicid_mask |= 1UL << ent->apic_id for apic_id < 64 (mptable.c:658-659). On pc64, 1UL<<id is 64-bit and bits 32..63 truncate to 0 when stored in the u_int, so ids 32..63 silently vanish from the mask while the fixup stays enabled (disable only for id >= 64, mptable.c:660-663); mask.ary[0] = ht_apicid_mask (mptable.c:784) then feeds mptable_hyperthread_fixup(), whose distance/boundary guards run over the partial set. For a table listing ids {0,2,33} on an HTT CPU with lcpus_max=2 the verbatim-logic reproducer shows the in-tree mask (0x5) passing the guards -> logical_cpus=2 -> cpu_count*=2 -> naps=5 with fake entries enumerated for phantom apic ids 1,3,34, while the true 64-bit mask (distances 2 vs 31 mismatch) correctly kills the fixup (return 0). Phantom ids are SIPId by start_all_aps (mp_machdep.c:482-505) and never check in, so boot waits forever on smp_startup_mask (mp_machdep.c:595) -> boot hang on mptable (non-ACPI) HT systems with such firmware tables. End-to-end manifestation UNTESTED (needs crafted firmware table + HTT CPU; standard guest uses the ACPI MADT path). The in-file comment XXX fixup for cpus >= 32 ? XXX (mptable.c:777-779) shows the author suspected this band without handling it.", "exploit_chain": "", "evidence": "run.log \u2014 trigger ids {0,2,33}: in-tree u_int mask=0x5 -> fixup ENGAGES: logical_cpus=2 ... phantom ids { 1 3 34 } vs true 64-bit mask=0x200000005 -> fixup returns 0 (killed); control ids {0,2} and {0,33,34} killed in both variants.", "kernel_refs": [ "sys/platform/pc64/x86_64/mptable.c:641", "sys/platform/pc64/x86_64/mptable.c:658", "sys/platform/pc64/x86_64/mptable.c:659", "sys/platform/pc64/x86_64/mptable.c:661", "sys/platform/pc64/x86_64/mptable.c:784", "sys/platform/pc64/x86_64/mptable.c:787", "sys/platform/pc64/x86_64/mp_machdep.c:595" ], "poc_changes": "No seed PoC existed; authored from scratch. Reproducer copies the cited mptable.c logic verbatim (u_int/u_char semantics preserved); KKASSERT is modeled as a kernel-panic path (setjmp-resumable in the harness), and pmap_mapdev/MMIO access is elided where userland cannot express it (clearly marked in the source header).", "attempts": 1, "guest_uname": "DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 root@dfbsd:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64", "runtime_sec": 300, "guest_dirty": 0, "build_cmd": "guest: cc -O2 -Wall -Wextra -o /tmp/htfix_mask_truncation /tmp/htfix_mask_truncation.c", "run_cmd": "guest: /tmp/htfix_mask_truncation", "code_hash": "f6bc30e0bf25c054023b7e2f6cf8ec7b5af9e621f47a9a05253aa6651471d7bc", "notes": "Boot-time, malicious-firmware/loader threat class (same bar as accepted DF-1034/DF-5326). Kernel-boot manifestation not armable on the standard QEMU/SeaBIOS guest (no MP-table/SMAP injection, no unprivileged in-guest path) \u2014 verification is the guest-executed verbatim-logic reproducer per the DF-5326 precedent. Guest left clean (only /tmp scratch).", "recommended_fix": "widen ht_apicid_mask to uint64_t and use 1ULL shifts (mptable.c:641,659)", "fix_status": "not_testable", "fix_baseline_reproduced": false, "fix_patched_reproduced": false, "fix_verdict": "fix.diff is authored against the read-only sys/ tree and passes git apply --check, but could not be kernel-build-validated: the bugs kernel manifestation cannot be armed on this guest (needs injected firmware tables), so there is no baseline to compare a patched kernel against.", "fix_evidence": "findings/poc/DF-5342/fix.diff (git apply --check passes); reasoning in VERDICT.md" } |