DF-3771 / verdict.json
{ "finding_id": "DF-3771", "status": "not_reproduced", "reproduced": 0, "impact": "none", "confidence": "certain", "verdict": "ahci_port_free() (sys/dev/disk/ahci/ahci.c:979-1046) frees ap_ccbs, DMA memory and the ahci_port without cancelling armed ccb->ccb_timeout callouts and without failing CCBs still in ap_ccb_pending/ap_active/ap_sactive. A late callout executes ahci_ata_cmd_timeout_unserialized() (ahci.c:3789-3799) which writes flags into the freed CCB and takes ap_sig_lock on the freed port - a kernel use-after-free write. Trigger requires runtime driver detach (module kldunload) with in-flight I/O, root-privileged. Not reproduced: the audit guest has no AHCI controller (virtio-blk root, pciconf shows no SATA device) and ahci is compiled into GENERIC so the detach path cannot be entered; defect is certain from source (no callout_cancel exists anywhere on the free path).", "exploit_chain": "", "evidence": "findings/poc/DF-3771/VERDICT.md (path:line analysis); env.txt (guest pciconf/kldstat proving device absence); ahci.c:997-1046 (free path, no callout handling) vs ahci.c:1884-1936 (hardstop shows required cleanup); ahci.c:2212-2220 (arming); ahci.c:3789-3799 (late callout body)", "kernel_refs": ["sys/dev/disk/ahci/ahci.c:997", "sys/dev/disk/ahci/ahci.c:1013", "sys/dev/disk/ahci/ahci.c:2212", "sys/dev/disk/ahci/ahci.c:3789", "sys/dev/disk/ahci/ahci_dragonfly.c:306"], "poc_changes": "No PoC possible: guest lacks AHCI hardware and ahci is compiled into the kernel (no kldunload path). Source-level verification only.", "attempts": 0, "guest_uname": "DragonFly dfbsd 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": 0, "guest_dirty": 0, "notes": "Guest evidence: pciconf -l shows no ahci/sata class device; root is vbd0s1d (virtio-blk); kldstat -v shows ahci registered from static kernel. All five DF-3771..3775 packs share env.txt. Root-only trigger (module unload) - Low severity.", "recommended_fix": "In ahci_port_free, before freeing: fail all outstanding CCBs (walk ap_active/ap_sactive/ap_ccb_pending like ahci_port_hardstop) and callout_cancel_sync each ccb_timeout; also lockuninit(ap_ccb_lock).", "fix_status": "not_testable", "fix_baseline_reproduced": 0, "fix_patched_reproduced": 0, "fix_verdict": "fix.diff authored from line-accurate source analysis mirroring ahci_port_hardstop() cleanup; cannot be build-validated on this guest (no AHCI controller, no module build path exercised).", "fix_evidence": "fix.diff in this pack; cleanup pattern copied from ahci.c:1884-1936." } |