Heap OOB write via double channel offset in RQCS_SYNCXFER_FAILED status handler
Summary
When SCSI command on channel 1 of dual-bus ISP adapter (ISP1080/1240/1280/12160) completes with RQCS_SYNCXFER_FAILED handler computes sdparam pointer twice with channel number advancing pointer one full sdparam struct past end of kmallocd isp_param array then performs 16-bit read-modify-write into OOB memory. SDPARAM(isp chan) already indexes by channel immediately-following sdp+=XS_CHANNEL(xs) double-applies channel offset. For dual-bus card isp_param allocated sizeof(sdparam)*isp->isp_nchan=2 entries. XS_CHANNEL==1 sdp starts &isp_param[1] (last valid) sdp+=1 moves &isp_param[2] one past end. Sibling RQCS_WIDE_FAILED at :6269-6272 LACKS erroneous sdp+=XS_CHANNEL line confirming extra line is bug. XS_TGT 16 choices gives ~256 bytes controllable offset.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-2469 Β· 6 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | Source trace confirming DF-2469 bug is real but HW-gated | 1.8 KB | β raw |
| fix.diff | suggested-fix | Remove erroneous sdp += XS_CHANNEL(xs) line causing double channel offset | 431 B | view raw |
| env.txt | environment | Guest gate proof: kldstat, pciconf, camcontrol (no target HBA) | 1.1 KB | view raw |
| build.sh | build-script | No buildable PoC (HW-gated) | 384 B | view raw |
| run.sh | run-script | Gate verification commands | 411 B | view raw |
| README.md | readme | Overview of HW-gated finding | 791 B | β raw |
HW-gated SCSI/FC HBA driver finding
This finding targets a SCSI/FC/SATA HBA driver that is not present in this QEMU/KVM guest (only PIIX3 IDE + virtio). The driver cannot attach and the cited code path is unreachable at runtime.
Reproduction status: NOT REPRODUCED (HW-gated)
- The source bug is confirmed real by line-by-line source trace (see VERDICT.md).
- It cannot be triggered because the HBA hardware/driver does not exist on this guest.
- A defense-in-depth
fix.diffhas been authored and validated withgit apply --check.
Evidence
VERDICT.mdβ full source trace and analysisenv.txtβ guest environment (kldstat, pciconf, camcontrol gate proof)fix.diffβ git-apply-able defense-in-depth fixmanifest.jsonβ machine-readable catalog
DF-2469 β Heap OOB write via double channel offset in RQCS_SYNCXFER_FAILED
Verdict: NOT REPRODUCED (HW-gated) β source bug CONFIRMED
Hardware gate
No QLogic ISP (FC/SCSI) HBA is present in this QEMU/KVM guest:
- kldstat: only kernel, ehci.ko, xhci.ko β no isp.ko module loaded
- pciconf -l: only PIIX3 IDE (atapci0), virtio-net, virtio-blk β no QLogic PCI device
- camcontrol devlist: only QEMU DVD-ROM
The isp driver cannot attach, so the cited code path (isp.c RQCS_SYNCXFER_FAILED
handler) is never reached at runtime. This is a latent source bug that can
only fire on real (or emulated) QLogic ISP1080/1240/1280/12160 dual-bus hardware.
Source trace (confirmed real bug)
File: sys/dev/disk/isp/isp.c:6282-6283
case RQCS_SYNCXFER_FAILED:
...
if (IS_SCSI(isp)) {
sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs)); // line 6282: indexes by channel
sdp += XS_CHANNEL(xs); // line 6283: double-applies channel offset β BUG
sdp->isp_devparam[XS_TGT(xs)].goal_flags &= ~DPARM_SYNC;
The sibling handler RQCS_WIDE_FAILED at lines 6266-6273 uses the same pattern
but without the erroneous sdp += XS_CHANNEL(xs) line β confirming the extra
line at 6283 is a bug, not intentional. For a dual-bus card (isp_nchan=2),
isp_param has 2 sdparam entries. SDPARAM(isp, 1) returns &isp_param[1],
then sdp += 1 moves to &isp_param[2] β one past the end β and the subsequent
16-bit read-modify-write corrupts adjacent heap.
Fix
Removed the erroneous sdp += XS_CHANNEL(xs); line. See fix.diff.
Impact (on HW that has the HBA)
Medium β heap OOB write of ~8 bytes (goal_flags RMW) at a controlled offset (~256 bytes range via XS_TGT). Requires a dual-bus ISP SCSI adapter with an active command completing with SDTR failure on channel 1.
Fix verification
not_testablenot_testable: target driver cannot attach (no target HBA). fix.diff validated with git apply --check (EXIT=0); fix is correct by source trace.
git apply --check findings/poc/DF-2469/fix.diff => EXIT=0. No runtime test possible (no target HBA).
Confirmed kernel references
Detail
Exploit chain
none β valid hard blocker (driver code path dead at runtime on this guest: no target HBA). No unprivileged->root path.
Evidence (decisive lines)
kldstat -> kernel/ehci/xhci only (no target driver); pciconf -l -> PIIX3 IDE + virtio only (no target HBA); camcontrol devlist -> only <QEMU QEMU DVD-ROM>. Source confirmed at cited lines.
PoC changes
Created findings/poc/DF-2469/{VERDICT.md,fix.diff,manifest.json,env.txt,build.sh,run.sh,README.md}. No PoC source (HW-gated).
Verified recommended fix
Defense-in-depth fix.diff closes the cited path (see findings/poc/DF-2469/fix.diff; git apply --check OK).
Verdict
NOT REPRODUCED (HW-gated). The bug is REAL in source (traced line-by-line): isp RQCS_SYNCXFER_FAILED double channel offset (sdp+=XS_CHANNEL double-applies; needs dual-bus QLogic ISP). Gate confirmed: kldstat (only kernel+ehci+xhci; no isp/mpt/sili/trm/sbp module loaded), pciconf -l (no QLogic ISP/LSI MPT/SiliconImage/Tekram/FireWire HBA β only PIIX3 IDE atapci0 + virtio), camcontrol devlist (only QEMU DVD-ROM). The target driver cannot attach so the cited code path is dead at runtime on this guest.
No comments yet.