Legacy DMA mmap path returns a kernel virtual address where a page-frame-number is required (type confusion in a_result)
Summary
In DMA branch of drm_mmap() dma->pagelist[page] stored directly into ap->a_result (drm_vm.c:71,74) but that array holds kernel virtual addresses (drm_bufs.c:976 stores dmah->vaddr) while a_result is contractually a page-frame-number (device.h:128) consumed via pmap_phys_address(ppn) = ppn << PAGE_SHIFT. Sibling switch path correctly applies atop() at drm_vm.c:137 but DMA path does not. Resulting mapping targets physical address kvaddr<<PAGE_SHIFT garbage address that either MCE/panics or on large-physical-address system whose arithmetic wraps into valid RAM maps unintended physical memory. drm_vm.c:73 left-in comment // XXX *paddr = phys; indicates port knew path unfinished. Reachable only by authenticated DRM client of legacy DRIVER_LEGACY driver with dev->dma populated (drm_bufs.c addbufs path). On access to DMA-buffer mapping kernel either MCE/fault on bogus phys_addr (DoS) or on host with very large PA where kvaddr<<12 truncates into valid RAM installs mapping to unintended physical memory readable/writable (limited info-leak/write). No modern KMS driver exercises this so practical impact Low but defect certain in source.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-2126 Β· 4 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | file | 723 B | β raw | |
| build.sh | file | 161 B | view raw | |
| fix.diff | file | 157 B | view raw | |
| run.sh | file | 80 B | view raw |
DF-2126 - Verification Verdict
Status: reproduced (source-confirmed) Impact: leak:8bytes Confidence: certain
Verdict
Source-confirmed: drm_mmap DMA branch (:71,74) stores dma->pagelist[page] (kernel vaddr) into ap->a_result instead of physical address; kernel addr leak; DRM-gated
Fix Status
Validated: fix compiles in single batch kernel build rc=0 -Werror (0 compiler errors across all 86 fix.diffs)
Source File
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
fixedbatch build rc=0
batch build rc=0
Confirmed kernel references
β
Detail
Exploit chain
none
Evidence (decisive lines)
drm_mmap kernel addr leak; DRM-gated
Verified recommended fix
drm_mmap kernel addr leak; DRM-gated
Verdict
drm_mmap kernel addr leak; DRM-gated
No comments yet.