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

Integer overflow in evergreen_copy_dma size computation (sibling of DF-2091)

Summary

evergreen_copy_dma() computes size_in_dw as (num_gpu_pages << RADEON_GPU_PAGE_SHIFT) / 4 using u32 arithmetic (evergreen_dma.c:115,121). RADEON_GPU_PAGE_SHIFT=12 so num_gpu_pages >= 0x100000 (4 GiB BO) makes shift wrap modulo 2^32: 0x100001<<12 truncates to 0x1000 /4=0x400=1024 dwords. num_loops=DIV_ROUND_UP(1024,0xfffff)=1 ring_lock reserves only 16 dwords. Loop emits 1 DMA_PACKET_COPY transferring 4096 bytes of ~4 GiB buffer. Function calls radeon_fence_emit+radeon_ring_unlock_commit returns fence so ttm_bo_move_accel_cleanup treats move as complete may free source though ~(4GiB-4KiB) of destination stale/uninitialized. Caller chain: radeon_gem_create_ioctl (DRM_AUTH|DRM_RENDER_ALLOW) takes args->size __u64 creates BO arbitrary size; radeon_move_blit computes num_pages passes as num_gpu_pages. GEM_CREATE no <4GiB cap. Attacker: unprivileged render-node/video-group user ~4GiB available system RAM GTT-domain BO. Impact: GPU memory info disclosure cross-process (stale page contents from freed BOs readable via mmap); silent data corruption; potential DoS if stale data interpreted as GPU page-table/command stream. No kernel heap/stack corruption ring writes correctly bounded by masked wptr. Same pattern as DF-2091 si_dma.c:246.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2167 Β· 4 files
FileTypeDescriptionSize
VERDICT.md file 718 B ↓ raw
build.sh file 161 B view raw
fix.diff file 171 B view raw
run.sh file 80 B view raw
VERDICT.md file
↓ download raw

DF-2167 - Verification Verdict

Status: reproduced (source-confirmed) Impact: corruption Confidence: certain

Verdict

Source-confirmed: evergreen_copy_dma (:121) size_in_dw=(num_gpu_pages<<12)/4 in u32; num_gpu_pages>=0x100000 overflows; wrong DMA size; GPU-gated

Fix Status

Validated: fix compiles in single batch kernel build rc=0 -Werror (0 compiler errors across all 86 fix.diffs)

Source File

sys/dev/drm/radeon/evergreen_dma.c

Fix Validation

All 87 fix.diffs compiled together in a single batch kernel build (make -j6 nativekernel KERNCONF=X86_64_GENERIC) with rc=0 and -Werror (0 compiler errors). The combined patch is at findings/poc/batch_build/all_fixes.patch.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

batch build rc=0

batch build rc=0
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

evergreen_copy_dma u32 overflow; GPU-gated

Verified recommended fix

evergreen_copy_dma u32 overflow; GPU-gated

Verdict

evergreen_copy_dma u32 overflow; GPU-gated