# VERDICT — DF-1484: amdgpu_cs IB chunk missing size check (OOB read of kdata)

## Verdict

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

The bug is real and present in master DEV source at `sys/dev/drm/amd/amdgpu/amdgpu_cs.c:181-184, 999`,
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)

amdgpu_cs_parser_bodies (181-184) AMDGPU_CHUNK_ID_IB case only does `++num_ibs` with no minimum-size check, unlike FENCE (188) and BO_HANDLES (202). kdata is allocated as kvmalloc_array(length_dw, 4) at 169 — for length_dw < 8 (=32/4), the allocation is smaller than `struct drm_amdgpu_cs_chunk_ib`. amdgpu_cs_ib_fill:999 then casts kdata to `struct drm_amdgpu_cs_chunk_ib *` and reads its fields (ip_type, flags, etc.) → OOB read of the (small) kdata allocation.

## Reachability on this guest

No — amdgpu HW-gated as above. Trigger is a CS chunk with chunk_id=AMDGPU_CHUNK_ID_IB and length_dw too small for struct drm_amdgpu_cs_chunk_ib (32 bytes).

## Phase 6 — escalation potential

This is a heap OOB read 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.

In the IB chunk case, check `length_dw * sizeof(uint32_t) < sizeof(struct drm_amdgpu_cs_chunk_ib)` and return -EINVAL like the FENCE/BO_HANDLES cases do.

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