# VERDICT — DF-1554: acpi_cpu_cstate.c zero cst_cx_count -> OOB + atomic poison

## Verdict

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

The bug is real and present in master DEV source at `sys/dev/acpica/acpi_cpu_cstate.c:530,1140,1144-1145,1142`, but
the affected driver attaches only to hardware not present in the audit QEMU
guest (only virtio+PIIX3 PCI devices, no AMD/Intel GPUs, no ath NICs, no
AdvanSys SCSI, no mfi/tws/mrsas RAID, etc.), so it cannot be live-triggered
here. The `fix.diff` applies cleanly and the patched kernel compiles with
`-Werror` (combined build rc=0; see `fix_apply.log`).

## Mechanism (cited path → primitive → effect)

acpi_cst_cx_probe_cst sets cst_cx_count=0; loop only increments on valid sub-package. If ALL sub-packages invalid, count stays 0 but function returns 0 (success) at 687. Sink 1: acpi_cst_set_lowest_oncpu 1140 if (val > sc->cst_cx_count-1) signed-int: 0-1=-1, val clamped to -1, cst_cx_states[-1].type read at 1144-1145 -> 4-byte heap OOB before softc. atomic_swap_int stores -1 -> all subsequent calls also OOB.

## Reachability on this guest

No — `sys/dev/acpica/acpi_cpu_cstate.c:530` is in a driver/module that only attaches
to hardware absent from the audit guest. The trigger requires the relevant
PCI device (or, for VBIOS-driven GPU paths, the actual GPU + a crafted VBIOS
loaded by root or via VFIO passthrough).

## Phase 6 — escalation potential

This is a Signed-int underflow -> heap OOB + persistent bad state 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).

Realistic impact ceiling on suitable HW: **kernel heap OOB read/write + persistent -1 stored in cst_cx_lowest**.

## 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 the combined
  `make -j6 nativekernel KERNCONF=X86_64_GENERIC` build (kernel build rc=0;
  see `manifest.json`).
- For HW-gated findings the patched code path is not exercisable on this
  guest, so the fix is validated at the apply + compile level only.

Fix approach: Return ENXIO from acpi_cst_cx_probe_cst when cst_cx_count==0.

## 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.
