# DF-4917 — VERDICT

**Status: not_reproduced (hardware-gated — no AMD GPU / SR-IOV VF in the audit
guest). The defect is certain from source and confirmed identical in upstream
Linux v4.19 (inherited, not port-introduced).**

## The defect

`amdgpu_virt.c:435-439`:

```c
			AMDGPU_FW_VRAM_VF2PF_WRITE(adev, checksum,
				amdgpu_virt_fw_reserve_get_checksum(
				adev->virt.fw_reserve.p_vf2pf,
				pf2vf_size,                /* <-- wrong */
				adev->virt.fw_reserve.checksum_key, 0));
```

The object being checksummed is the **vf2pf** message just written at
`p_vf2pf`, whose size is `sizeof(amdgim_vf2pf_info)` — the same value the
code itself wrote into the vf2pf header two statements earlier
(`amdgpu_virt.c:423-424`). Instead the length passed is `pf2vf_size` — the
**pf2vf** message's host-controlled length ∈ (0, 4096) (`amdgpu_virt.c:411`).

Consequences:

1. **OOB read:** the sum loop at `amdgpu_virt.c:383-384` reads
   `pf2vf_size` bytes from `p_vf2pf`. With `pf2vf_size` up to 4095 and a
   1024-byte struct, up to ~3 KB past the end of the vf2pf area is read. The
   exchange area ends at `p_pf2vf + pf2vf_size + 1024`; the read ends at
   `p_pf2pf + 2*pf2vf_size`, which exceeds it by `pf2vf_size - 1024` bytes.
   Combined with DF-4916's missing region check this can walk off the kmap;
   with a generous reservation it silently reads unrelated VRAM.
2. **Wrong checksum:** the value published to the host covers `key + N
   garbage bytes − 0`, not the vf2pf message, so any consumer that verifies
   per the GIM protocol discards the guest's message — breaking the
   feature-flag/error-log exchange (`adev->virt.gim_feature` consumers) on
   otherwise healthy hosts.

Upstream comparison: Linux v4.19 `drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c`
line 429-433 passes `pf2vf_size` identically — the bug was inherited from the
vanilla source this tree ported (verbatim diff archived in the analysis; the
same lines existing in DF at `amdgpu_virt.c:435-439`).

## Why not reproduced on the audit guest

No AMD PCI device in the guest (`env.txt`); the function is unreachable
(`fw_vram_usage.va == NULL`). Hardware-gated → not_reproduced here; the
source-level defect is certain.

## Exploit chain

None — host-visible protocol corruption + bounded OOB read of VRAM adjacent
to the exchange area. No guest-privileged primitive.

## Recommended fix

```diff
--- a/sys/dev/drm/amd/amdgpu/amdgpu_virt.c
+++ b/sys/dev/drm/amd/amdgpu/amdgpu_virt.c
@@ -435,7 +435,7 @@ void amdgpu_virt_init_data_exchange(struct amdgpu_device *adev)
 				AMDGPU_FW_VRAM_VF2PF_WRITE(adev, checksum,
 					amdgpu_virt_fw_reserve_get_checksum(
 					adev->virt.fw_reserve.p_vf2pf,
-					pf2vf_size,
+					sizeof(amdgim_vf2pf_info),
 					adev->virt.fw_reserve.checksum_key, 0));
```

## Fix status (batch validation)
Applied with the 36 sibling fix.diffs of this batch in findings/poc/_batch41/all_fixes.patch; single in-guest `make -j6 nativekernel KERNCONF=X86_64_GENERIC` completed RC=0 with zero errors under -Werror (full log: findings/poc/_batch41/fix_build8.log). Behavior A/B intentionally skipped for this Info-tier item.

(No fix.diff for this item: documented recommendation only - see Fix above.)
