OOB kernel-heap read in rv7xx_parse_power_table via unchecked VBIOS offsets and indices
Summary
rv7xx_parse_power_table at rv770_dpm.c:2294-2320: power_state=bios+data_offset+usStateArrayOffset+i*ucStateEntrySize, non_clock_info=...+usNonClockInfoArrayOffset+ucNonClockStateIndex*ucNonClockSize, clock_info=...+usClockInfoArrayOffset+idx[j]*ucClockInfoSize. All offsets/indices from VBIOS (u16/u8), NO bounds check vs BIOS allocation (max 256KB). Crafted VBIOS with large offsets -> pointers past allocation -> OOB heap read. Max offset ~0x2FCFF >> 256KB. Sibling of DF-1198/DF-1250/DF-1252. Crafted VBIOS PCIe passthrough/hotplug. Fix: validate pointers against table size from atom_parse_data_header.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1333 Β· 10 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | git-apply-able fix; compile-validated under -Werror in the radeon module | 2.7 KB | view raw |
| VERDICT.md | verdict | full source trace + reachability analysis + compile-validation | 3.7 KB | β raw |
| README.md | readme | summary, mechanism, trigger conditions, fix | 3.3 KB | β raw |
| build.sh | build | module build that validated the fix compiles | 368 B | view raw |
| run.sh | run | guest reachability probe | 653 B | view raw |
| build_fix.log | build-log | full radeon module build output (rc=0, -Werror) | 3.6 KB | view raw |
| env.txt | environment | uname, cc, PCI/kldstat/device-node state proving no GPU/audio | 487 B | view raw |
| check_guest.sh | run | radeon reachability probe | 747 B | view raw |
| ../fix_build_combined.log | build-log | Combined 41-finding kernel build (rc=0, -Werror clean) | 5.6 MB | β download |
| ../fix_build_summary.txt | build-summary | Summary of the combined 41-finding kernel build | 826 B | view raw |
DF-1333 β OOB kernel-heap read in rv7xx_parse_power_table via unchecked VBIOS offsets/indices
File: sys/dev/drm/radeon/rv770_dpm.c:2284-2326
Class: OOB read / info leak
Status: INCONCLUSIVE at runtime β confirmed real source bug, hardware-gated on this guest
The vulnerable code path was traced line-by-line in sys/ and confirmed to be a genuine bug
(missing bounds check / integer overflow / UAF race). However it is not exercisable on the
DragonFly audit guest because the guest has neither an AMD GPU nor any audio controller:
- PCI shows only
vgapci0 class=0x030000(QEMU stdvga, chip0x11111234) β no AMD GPU. - No PCI audio device (class
0x0401/0x0403);hw.sndempty; no/dev/dsp. radeon.kois a loadable module only (NOT inX86_64_GENERIC), is not loaded, and cannot bekldload'd by an unprivileged user β and even if loaded would not attach without the hardware.
This is the valid hard-blocker case "vulnerable code path unreachable at runtime on this guest AND no harness can exercise it (device-integrated parser / ioctl / hardware-dependent race)." The bug is a real latent defect that would manifest on a system with the relevant hardware + the module loaded.
Mechanism (confirmed by source trace)
rv7xx_parse_power_table() builds pointers into the kmalloc'd VBIOS image (atom_context->bios, max 256KB) using offsets and indices taken verbatim from the (attacker-controlled) VBIOS power table: usStateArrayOffset (u16), usNonClockInfoArrayOffset (u16), usClockInfoArrayOffset (u16), ucNonClockStateIndex (u8) and the per-state clock indices idx[j] (u8), each scaled by u8 entry sizes. None of these are validated against the BIOS allocation size. A crafted VBIOS with large offsets makes power_state / non_clock_info / clock_info point past the allocation, so the driver reads out of bounds when it later dereferences those structs in rv7xx_parse_pplib_*_clock_info.
Live trigger conditions
Requires an AMD Radeon RV770-family GPU whose VBIOS power table is attacker-controlled (crafted VBIOS via PCIe passthrough / hotplug / malicious option-ROM). Reached during rv770_dpm_init() -> rv7xx_parse_power_table() at driver attach.
Fix
A standalone, git apply-able fix is in fix.diff. Compile-validated: applied to in-guest
/usr/src and the radeon module rebuilt under -Werror (rc=0, no warnings/errors in the
patched translation unit). See build_fix.log.
Capture the data-table size from atom_parse_data_header() (new data_size out-param) and, before every state/non-clock/clock-info pointer deref, check the computed offset + entry size <= data_size, breaking out of the loop on overflow and setting num_ps to the count actually parsed. Supersedes the finding markdown proposal (which only suggested the approach).
Reproduce / validate
# 1. Confirm the bug site exists (read-only source trace): grep -n ... sys/dev/drm/radeon/rv770_dpm.c # 2. Validate the fix compiles (on the audit guest): scp -F dfbsd-qemu/config findings/poc/DF-1333/fix.diff dfbsd:/root/fix.diff ./dfbsd-qemu/vm.sh run_root 'cd /usr/src && patch -p1 --forward < /root/fix.diff' ./dfbsd-qemu/vm.sh run_root 'cd /usr/src/sys/dev/drm/radeon && KERNCONF=X86_64_GENERIC SYSDIR=/usr/src/sys make -m /usr/src/share/mk' # 3. (requires real hardware) Exercise the bug: attach an AMD GPU / audio device and trigger.
VERDICT β DF-1333
Verdict: INCONCLUSIVE at runtime; source bug CONFIRMED; fix COMPILE-VALIDATED
Citations confirmed: sys/dev/drm/radeon/rv770_dpm.c:2284, sys/dev/drm/radeon/rv770_dpm.c:2294, sys/dev/drm/radeon/rv770_dpm.c:2296, sys/dev/drm/radeon/rv770_dpm.c:2300, sys/dev/drm/radeon/rv770_dpm.c:2317, sys/dev/drm/radeon/atom.h:125
Is the bug real? β YES (source trace)
rv7xx_parse_power_table() builds pointers into the kmalloc'd VBIOS image (atom_context->bios, max 256KB) using offsets and indices taken verbatim from the (attacker-controlled) VBIOS power table: usStateArrayOffset (u16), usNonClockInfoArrayOffset (u16), usClockInfoArrayOffset (u16), ucNonClockStateIndex (u8) and the per-state clock indices idx[j] (u8), each scaled by u8 entry sizes. None of these are validated against the BIOS allocation size. A crafted VBIOS with large offsets makes power_state / non_clock_info / clock_info point past the allocation, so the driver reads out of bounds when it later dereferences those structs in rv7xx_parse_pplib_*_clock_info.
Can it be reproduced on this guest? β NO (hardware-gated)
Requires an AMD Radeon RV770-family GPU whose VBIOS power table is attacker-controlled (crafted VBIOS via PCIe passthrough / hotplug / malicious option-ROM). Reached during rv770_dpm_init() -> rv7xx_parse_power_table() at driver attach.
Guest evidence (env.txt): only vgapci0 class=0x030000 chip=0x11111234 (QEMU stdvga); no AMD GPU;
no PCI audio device; kldstat shows no drm/radeon/amdgpu/snd module; /dev/dri and /dev/dsp* do
not exist. The radeon module is not in X86_64_GENERIC, is not loaded, and cannot be loaded by
an unprivileged user (kldload is root-only); even loaded, it would not attach without the hardware.
Therefore the vulnerable code is unreachable at runtime here. Because the sinks are device-integrated
parsers / DRM ioctls / a hardware-dependent channel race, no userspace harness on this guest can
exercise them. This is the documented valid hard-blocker "unreachable at runtime + no feasible
harness"; the bug is a real latent defect with the live trigger conditions noted above.
No escalation chain (and why that is correct here)
There is no memory-corruption primitive to escalate on this guest: the corruption sinks live entirely
inside the not-loaded radeon driver behind hardware that is absent. The escalation work the
audit expects (slab groom -> victim -> uid0) presupposes a reachable write primitive; here there is
none on the guest. The deliverable is therefore the confirmed root-cause + a compile-validated fix.
Fix (fix.diff) β authored and COMPILE-VALIDATED
Capture the data-table size from atom_parse_data_header() (new data_size out-param) and, before every state/non-clock/clock-info pointer deref, check the computed offset + entry size <= data_size, breaking out of the loop on overflow and setting num_ps to the count actually parsed. Supersedes the finding markdown proposal (which only suggested the approach).
The fix was applied to in-guest /usr/src (all hunks applied cleanly) and the radeon module was
rebuilt with the kernel's -Werror flags:
cd /usr/src/sys/dev/...radeon... && KERNCONF=X86_64_GENERIC SYSDIR=/usr/src/sys make -m /usr/src/share/mk
=> rc=0, no warnings/errors in the patched translation unit (build_fix.log). The runtime
before/after of the bug cannot be tested on this guest (no hardware), so fix_status is not_testable
(diff applies + compiles; code path traced closed).
Why not not_reproduced (false-positive)?
This is NOT a false positive. The cited sys/ code is genuinely missing the guard / has the overflow
/ has the race β verified by reading the source. It is a real bug that is simply out of reach of this
particular (GPU/audio-less) QEMU guest.
Fix verification
not_testablecompile validated -Werror
module build rc=0
Confirmed kernel references
β
Detail
Exploit chain
none
Evidence (decisive lines)
β
Verdict
Source-confirmed. rv7xx_parse_power_table VBIOS u16 offsets no bounds -> OOB heap read. radeon not in GENERIC.
No comments yet.