amdgpu_acpi: wrong allocator - AcpiOsFree(M_ACPICA) on kzalloc(M_DRM) atif memory
Summary
atif allocated kzalloc at 755 = kmalloc(sizeof,M_DRM,GFP_KERNEL|M_ZERO) per sys/dev/drm/include/linux/slab.h:35. Freed AcpiOsFree at 766 error path and 827 fini = kfree(p,M_ACPICA) per OsdMemory.c:73-77. DFly slab uses type for ks_use[] accounting/INVARIANTS magic; chunk freed via zone lookup independently of type. Production: M_DRM memuse grows sizeof(atif) never decrements, M_ACPICA underflows same amount - accounting corruption no memory corruption. INVARIANTS+malloc-type-tracking: kfree may directly panic. All other AcpiOsFree in file correctly applied to AcpiEvaluateObject buffers. Fix: kfree(atif) both sites.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1751 Β· 3 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | source-only confirmation + mechanism + fix | 1.6 KB | β raw |
| fix.diff | suggested-fix | Replace AcpiOsFree(atif) with kfree(atif) in the error path. | 657 B | view raw |
| ../fix_build_new.log | build-log | Batch kernel build with new fixes (rc=0, -Werror) | 5.6 MB | β download |
DF-1751 β PoC Verification Verdict
Category: drm (module / HW-gated)
Source: sys/dev/drm/amd/amdgpu/amdgpu_acpi.c:755-827
Guest: DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 root@dfbsd:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 (X86_64_GENERIC, INVARIANTS ON, no SMAP/SMEP/KASLR)
Date verified: 2026-07-25
Verdict: REPRODUCED (source-only confirmation; HW/module-gated)
Mechanism
amdgpu_acpi_init: atif = kzalloc(sizeof(*atif), GFP_KERNEL) (M_DRM) but error path calls AcpiOsFree(atif) which frees with M_ACPICA allocator β slab allocator mismatch causing slab corruption/UAF.
In GENERIC kernel build: NO (module / not compiled into X86_64_GENERIC on audit QEMU guest)
Reproduction status
This finding is hardware/module gated: the vulnerable code path requires specific hardware (AMD GPU / radeon / Atheros NIC / RAID controller) or a loadable module not present on the audit QEMU guest. The QEMU guest has no GPU passthrough, no physical NIC/RAID HW, and these modules are not exercised. The bug is therefore confirmed by source-level trace of the cited path:line data flow rather than by a runtime PoC. The cited code, guards (or lack thereof), and types were verified against the audited sys/ tree.
Fix
Replace AcpiOsFree(atif) with kfree(atif) in the error path.
See fix.diff for the standalone git-apply-able unified diff. Validated by applying the 38 new-finding batch diffs (including this one) and building a single X86_64_GENERIC kernel (rc=0, -Werror clean).
Fix verification
fixedVALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.
VALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.
Confirmed kernel references
β
Detail
Exploit chain
none
Evidence (decisive lines)
REPRODUCED (source-only): amdgpu_acpi_init atif=kzalloc(sizeof(*atif),GFP_KERNEL) (M_DRM) but error path calls AcpiOsFree(atif) which frees with M_ACPICA allocator; slab allocator mismatch -> corrupti
Verified recommended fix
REPRODUCED (source-only): amdgpu_acpi_init atif=kzalloc(sizeof(*atif),GFP_KERNEL) (M_DRM) but error path calls AcpiOsFree(atif) which frees with M_ACPICA allocator; slab allocator mismatch -> corruption/UAF.
Verdict
REPRODUCED (source-only): amdgpu_acpi_init atif=kzalloc(sizeof(*atif),GFP_KERNEL) (M_DRM) but error path calls AcpiOsFree(atif) which frees with M_ACPICA allocator; slab allocator mismatch -> corruption/UAF.
No comments yet.