OOB read / deterministic panic in mpt_disable_lun via wildcard LUN (loop indexes trt[lun] not trt[i])
Summary
mpt_disable_lun iterates with loop variable i but reads mpt->trt[lun] instead of mpt->trt[i]. When invoked with wildcard LUN (CAM_LUN_WILDCARD=0xFFFFFFFF) together with wildcard target - valid XPT_EN_LUN combination accepted not rejected - code reaches mpt->trt[0xFFFFFFFF].enabled a ~100GB OOB read that faults kernel and panics deterministically. Same typo also breaks LUN-disabling bookkeeping for normal case. Contrast mpt_scsi_tgt_atio at :5038 correctly short-circuits lun>=MPT_MAX_LUNS. mpt_disable_lun has no equivalent guard. Reachable from XPT_EN_LUN enable=0 wildcard target+lun.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-2535 Β· 6 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | Source trace confirming DF-2535 bug is real but HW-gated | 1.3 KB | β raw |
| fix.diff | suggested-fix | Fix typo: change trt[lun] to trt[i] in mpt_disable_lun loop | 312 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-2535 β OOB read / panic in mpt_disable_lun via wildcard LUN
Verdict: NOT REPRODUCED (HW-gated) β source bug CONFIRMED
Hardware gate
No LSI Logic MPT HBA in guest: kldstat shows only kernel/ehci/xhci; pciconf -l
shows no LSI device. mpt target-mode LUN enable/disable is never exercised.
Source trace (confirmed real bug)
File: sys/dev/disk/mpt/mpt_cam.c:4335
for (i = 0; i < MPT_MAX_LUNS; i++) {
if (mpt->trt[lun].enabled) { // line 4335: TYPO β should be trt[i]
break;
}
}
The loop iterates with i but reads mpt->trt[lun] (the function parameter)
instead of mpt->trt[i]. When invoked with wildcard LUN (CAM_LUN_WILDCARD=0xFFFFFFFF)
together with wildcard target β a valid XPT_EN_LUN combination accepted at line
4322 β lun is 0xFFFFFFFF, so mpt->trt[0xFFFFFFFF].enabled is a ~100GB OOB
read that faults the kernel and panics deterministically. The sibling function
mpt_scsi_tgt_atio at line 5038 correctly short-circuits lun >= MPT_MAX_LUNS;
mpt_disable_lun has no such guard before the buggy loop.
Fix
Changed mpt->trt[lun].enabled to mpt->trt[i].enabled in the loop body.
See fix.diff.
Impact (on HW that has the HBA)
Medium β deterministic kernel panic from XPT_EN_LUN with wildcard target+LUN.
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-2535/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-2535/{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-2535/fix.diff; git apply --check OK).
Verdict
NOT REPRODUCED (HW-gated). The bug is REAL in source (traced line-by-line): mpt_cam OOB read/panic in mpt_disable_lun (typo trt[lun] vs trt[i] with lun=0xFFFFFFFF wildcard; needs MPT target mode). 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.