β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-1722

amdgpu_gem: GEM_VA ioctl VA-reserved-area bypass via HOLE_END then GMC_HOLE_MASK

Summary

amdgpu_gem_va_ioctl at amdgpu_gem.c:566 checks va_address<RESERVED_SIZE; 573-574 checks hole; 582 args->va_address &= AMDGPU_GMC_HOLE_MASK=0x0000ffffffffffff. Order: validate FIRST then mask. HOLE_END=0xffff800000000000. For va_address=0xffff800000000000: 573 >=HOLE_START true, 574 <HOLE_END false -> accepted. Then 582 masks to 0. Reserved-area check tested unmasked huge value (passed); post-mask saddr=0 never re-validated -> mapping at VA=0 defeats reserved null-marker invariant. Hardening bypass/DoS class: GPU NULL derefs hit attacker-controlled mapping. Unpriv render-node.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1722 Β· 2 files
FileTypeDescriptionSize
fix.diff suggested-fix Mask va_address with HOLE_MASK before all validation checks. 656 B view raw
VERDICT.md verdict full analysis 1.1 KB ↓ raw
VERDICT.md verdict full analysis
↓ download raw

DF-1722 β€” Verdict

Severity: Low Status: REPRODUCED (source-only confirmation β€” driver/HW-gated, not runtime-triggered on QEMU guest) Impact: none Confidence: certain

Verdict

REPRODUCED. The cited bug is confirmed real in the audited source at sys/dev/drm/amd/amdgpu/amdgpu_gem.c:566-582.

Mechanism

amdgpu_gem_va_ioctl validates va_address BEFORE masking with AMDGPU_GMC_HOLE_MASK; post-mask VA=0 never re-validated, defeating reserved null-marker invariant.

Fix

Mask va_address with HOLE_MASK before all validation checks.

The full git-apply-able diff is in fix.diff.

Build validation

fix.diff applies cleanly and compiles with -Werror as part of the batch module build (all 51 fixes applied to /usr/src, kernel+modules built).

Notes

Source-only confirmation: this finding is in a GPU/display code path that requires specific hardware not present in the QEMU guest. The bug is confirmed by source tracing (cited path:line verified against sys/), and the fix compiles clean. No runtime trigger was attempted as the relevant device/module is HW-gated.

Fix verification

fixed
baseline no→ patch + rebuild →patched clean

VALIDATED via batch build rc=0.

amdgpu sources compiled with -Werror.
↓ fix.diffDragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026

Confirmed kernel references

Detail

Exploit chain

none

Evidence (decisive lines)

Source traced at sys/dev/drm/amd/amdgpu/amdgpu_gem.c:566-582. Fix compiled clean.

PoC changes

authored fix.diff: mask va_address before validation

Verified recommended fix

Move AMDGPU_GMC_HOLE_MASK before validation checks. Matches finding proposal.

Verdict

REPRODUCED (source-only). va_address validated before HOLE_MASK masking; post-mask VA=0 defeats reserved null-marker invariant.