# VERDICT — DF-1474: mprsas_fw_work iterates event PHY/Element arrays past allocation

## Verdict

**INCONCLUSIVE (HW/module gated) — source-level confirmed, fix validated.**

The bug is real and present in master DEV source at `sys/dev/raid/mpr/mpr_sas_lsi.c:216, 294`,
but the affected driver attaches only to hardware not present in the audit QEMU
guest, so it cannot be live-triggered here. The fix.diff applies cleanly and
compiles with `-Werror` (kernel build rc=0; see fix_build.log).

## Mechanism (cited path → primitive → effect)

Lines 211-241 (SAS_TOPOLOGY_CHANGE_LIST) and 284-… (IR_CONFIGURATION_CHANGE_LIST) loop `i < data->NumEntries` / `i < event_data->NumElements`, where NumEntries/NumElements are u8/u32 read from inside the event buffer. The PHY[1]/ConfigElement[1] declarations are flexible-array trailers; the actual allocation is `EventDataLength*4` bytes (mpr_sas_lsi.c:148-149). Firmware-supplied NumEntries/NumElements > what fits in the allocation drives OOB heap reads of the event_data buffer.

## Reachability on this guest

No — mpr(4) is in GENERIC but only attaches to LSI SAS3 HBAs (PCI ID 1000:0097 etc.). No HW in the audit guest; trigger is a malicious/emulated SAS3 HBA emitting crafted event replies.

## Phase 6 — escalation potential

This is a heap OOB read (firmware-controlled count) primitive. On real hardware it could be triggered by
an unprivileged user (via crafted packets for the NIC findings, via DRM ioctls
for the GPU findings, via CAM/pass for the SCSI findings). On **this guest**
there is no live primitive to convert. Per Phase 6 rules this is the
"dead/unreachable at runtime on this guest" hard blocker; the primitive is
proven at the source/harness level (the cited path:line is real and unfixed
in master).

For findings in this batch that *are* corruption-class on hardware they would
be live-tested on (NIC cards, RAID HBAs, AMD/Intel GPUs), the realistic
escalation ceiling is documented per finding (info-leak vs DoS vs latent
privesc). No `uid=0` claim is made — none is reachable on this guest.

## Phase 8 — fix validation

`fix.diff` is a minimal, targeted fix at the root cause confirmed above.

- **Applied cleanly** with `patch -p1 --forward` (verified in `fix_apply.log`).
- **Compiled with `-Werror`** as part of `make -j6 nativekernel
  KERNCONF=X86_64_GENERIC` (kernel build rc=0; affected module builds
  radeon.ko/amdgpu.ko/sound.ko/i915.ko/vga_switcheroo.ko all produced).
- For musycc.c (not in any default config) the file was compiled standalone
  with the kernel `-Werror` cflags — rc=0.

Track event_data_sz in mpr_fw_event_work; bound both loops by `(i+1)*sizeof(entry) <= event_data_sz`.

## PoC changes

Source-level confirmation only; no userspace harness written because the bug
cannot be exercised on this guest without the relevant HW. The placeholder
`build.sh`/`run.sh` echo pointers to `VERDICT.md` and the module/kernel
rebuild path.
