# PoC DF-1528: mrsas_fp.c MR_ValidateMapInfo insufficient per-LD/span/row validation

**Class:** Firmware-controlled index OOB
**Cited site:** `sys/dev/raid/mrsas/mrsas_fp.c:247-265, 1428-1429, 191, 201`

## Reproduction status

HW/module gated — **cannot be live-triggered on the audit QEMU guest.**

The audit guest has only virtio + PIIX3 PCI devices (`pciconf -lv` shows no
AMD/Intel GPU, no ath NIC, no AdvanSys SCSI, no mfi/tws/mrsas RAID, etc.),
so the cited code path is not reachable at runtime on this guest.

The bug is **confirmed at the source level** by tracing the cited path:line
in `sys/dev/raid/mrsas/mrsas_fp.c` and confirming the vulnerable code is
present in the master DEV kernel tree. The `fix.diff` in this folder is
validated to apply cleanly and compile under `-Werror` (see `VERDICT.md`).

## Mechanism

MR_ValidateMapInfo only verifies firmware totalSize matches ldCount-derived size; no per-LD/per-span/per-row validation. spanDepth u8 drives spanBlock[MAX_RAIDMAP_SPAN_DEPTH=8] loop; noElements u32 drives quad[8] loop; modFactor u8 indexes dataArmMap[MAX_RAIDMAP_ROW_SIZE=32]; rowSize u8 -> arMapInfo[].pd[32]. All values firmware-controlled.

## Realistic impact ceiling (on suitable HW)

kernel heap OOB read/write via malicious PCIe RAID controller (VFIO passthrough) -> panic or privesc primitive

## Fix

Reject pFwRaidMap->ldCount > MAX_LOGICAL_DRIVES or == 0 at the top of MR_ValidateMapInfo.

See `fix.diff` for the git-apply-able patch.

## How to validate the fix

```sh
scp -F dfbsd-qemu/config fix.diff dfbsd:/root/DF-1528.diff
ssh -F dfbsd-qemu/config dfbsd 'cd /usr/src && patch -p1 --forward < /root/DF-1528.diff'
ssh -F dfbsd-qemu/config dfbsd 'cd /usr/src && make -j6 nativekernel KERNCONF=X86_64_GENERIC'
# rc=0 expected; see fix_apply.log + fix_build.log in this folder.
```
