VBIOS power-table parsing dereferences attacker-controlled offsets with no bounds checks
Summary
rv6xx_parse_power_table at rv6xx_dpm.c:1889-1922: power_state/non_clock_info/clock_info computed from VBIOS u16/u8 fields (usStateArrayOffset, usNonClockInfoArrayOffset, usClockInfoArrayOffset, ucStateEntrySize, ucNonClockSize, ucClockInfoSize, ucNonClockStateIndex, idx[j]) with NO bounds check vs BIOS allocation. atom_context has no bios_size field. Crafted VBIOS -> OOB heap read. Sibling of DF-1333 (rv770 same pattern). Fix: add bios_size to atom_context, validate all offsets.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1391 Β· 9 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | git-apply-able fix; compile-validated under -Werror in the radeon build | 4.2 KB | view raw |
| VERDICT.md | verdict | full source trace + reachability analysis + compile-validation | 3.2 KB | β raw |
| README.md | readme | summary, mechanism, trigger conditions, fix | 3.3 KB | β raw |
| build.sh | build | script that applies fix.diff and rebuilds the radeon | 383 B | view raw |
| run.sh | run | guest reachability probe | 642 B | view raw |
| build_fix.log | build-log | build log slice showing the patched file compiles cleanly (rc=0) | 1.2 KB | view raw |
| env.txt | environment | uname, cc, PCI/kldstat/device-node state proving no HW | 1.4 KB | 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-1391 -- rv6xx_parse_power_table derefs attacker-controlled VBIOS pointers
File: sys/dev/drm/radeon/rv6xx_dpm.c:1889
Class: memory corruption (heap OOB / OOB write / OOB read)
Status: INCONCLUSIVE at runtime -- CONFIRMED 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 / unvalidated HBA-supplied
index). However it is not exercisable on the DragonFly audit guest because the
guest has no radeon hardware:
- PCI shows only QEMU stdvga (
vgapci0 class=0x030000 chip=0x11111234), virtio_net and virtio_blk -- no AMD GPU, no Intel iGPU, no LSI SAS HBA, no floppy controller, no TI ThunderLAN NIC, no Emulex OneConnect NIC, no BusLogic SCSI HBA. - The radeon driver (whether a loadable .ko or compiled-in) never attaches.
/dev/fd0,/dev/dri,/dev/dsp*do not exist on this guest.
This is the valid hard-blocker "vulnerable code path unreachable at runtime on this guest AND no harness can exercise it" -- the bug is a real latent defect that would manifest on a system with the relevant hardware (or, for VBIOS-driven bugs, a crafted VBIOS via passthrough/hotplug).
Mechanism (confirmed by source trace)
rv6xx_parse_power_table() computes power_state/non_clock_info/clock_info from VBIOS u16/u8 fields (usStateArrayOffset, usNonClockInfoArrayOffset, usClockInfoArrayOffset, ucStateEntrySize, ucNonClockSize, ucClockInfoSize, ucNonClockStateIndex, idx[j]) with NO bounds check vs the BIOS allocation. atom_context has no bios_size field, so the parser cannot detect OOB. Crafted VBIOS -> OOB heap read. Sibling of DF-1333 (rv770 same pattern).
Live trigger conditions
Requires the radeon hardware (and the driver loaded). For VBIOS-driven bugs, requires a crafted VBIOS via PCI passthrough or hotplug. The audit QEMU guest has none of this hardware, so the bug is unreachable here.
Fix
A standalone, git apply-able fix is in fix.diff. Compile-validated: applied
to in-guest /usr/src and built with the kernel's -Werror flags (rc=0, no
warnings/errors in the patched translation unit). See build_fix.log.
Three-file change: (1) added uint32_t bios_size to struct radeon_device
(radeon.h); (2) populated it at every rdev->bios allocation site in
radeon_bios.c (5 sites); (3) added bounds checks against rdev->bios_size at
every pointer arithmetic in rv6xx_parse_power_table (state, non_clock_info,
idx array, clock_info) with an inval: error path. (supersedes the finding
proposal which suggested adding bios_size to atom_context; this is equivalent
but keeps the change inside the radeon driver.)
Reproduce / validate
# 1. Confirm the bug site (read-only source trace): grep -n ... sys/dev/drm/radeon/rv6xx_dpm.c # 2. Compile-validate the fix on the audit guest: scp -F dfbsd-qemu/config findings/poc/DF-1391/fix.diff dfbsd:/root/DF-1391.fix.diff ./dfbsd-qemu/vm.sh run_root 'cd /usr/src && patch -p1 --forward < /root/DF-1391.fix.diff' # Then either: # cd /usr/src && make -j6 nativekernel KERNCONF=X86_64_GENERIC # kernel-internal drivers # OR # cd /usr/src/sys/dev/drm/<module> && KERNCONF=X86_64_GENERIC SYSDIR=/usr/src/sys make -m /usr/src/share/mk # GPU modules # 3. (requires real hardware) Exercise the bug: attach the HW and trigger.
VERDICT -- DF-1391
Verdict: INCONCLUSIVE at runtime; source bug CONFIRMED; fix COMPILE-VALIDATED
Citations confirmed: - sys/dev/drm/radeon/rv6xx_dpm.c:1889 - sys/dev/drm/radeon/rv6xx_dpm.c:1896 - sys/dev/drm/radeon/rv6xx_dpm.c:1901 - sys/dev/drm/radeon/rv6xx_dpm.c:1916 - sys/dev/drm/radeon/rv6xx_dpm.c:1918
Is the bug real? -- YES (source trace)
rv6xx_parse_power_table() computes power_state/non_clock_info/clock_info from VBIOS u16/u8 fields (usStateArrayOffset, usNonClockInfoArrayOffset, usClockInfoArrayOffset, ucStateEntrySize, ucNonClockSize, ucClockInfoSize, ucNonClockStateIndex, idx[j]) with NO bounds check vs the BIOS allocation. atom_context has no bios_size field, so the parser cannot detect OOB. Crafted VBIOS -> OOB heap read. Sibling of DF-1333 (rv770 same pattern).
Can it be reproduced on this guest? -- NO (hardware-gated)
No AMD GPU in PCI list; radeon.ko not loaded.
The radeon driver is a loadable module only (NOT in X86_64_GENERIC), is not loaded, and cannot be kldload'd 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 / DMA-supplied indices / hardware-dependent paths, 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-attached 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
Three-file change: (1) added uint32_t bios_size to struct radeon_device
(radeon.h); (2) populated it at every rdev->bios allocation site in
radeon_bios.c (5 sites); (3) added bounds checks against rdev->bios_size at
every pointer arithmetic in rv6xx_parse_power_table (state, non_clock_info,
idx array, clock_info) with an inval: error path. (supersedes the finding
proposal which suggested adding bios_size to atom_context; this is equivalent
but keeps the change inside the radeon driver.)
The fix was applied to in-guest /usr/src (all hunks applied cleanly) and the
module was rebuilt with the kernel's -Werror flags: cd /usr/src/sys/dev/drm/radeon && KERNCONF=X86_64_GENERIC SYSDIR=/usr/src/sys make -m /usr/src/share/mk => rc=0 (see build_fix.log). No warnings or errors in the patched translation unit. 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 unclamped loop -- verified by reading the source. It is a real bug that is simply out of reach of this particular (driverless) QEMU guest.
Confirmed kernel references
- s
- y
- s
- /
- d
- e
- v
- /
- d
- r
- m
- /
- r
- a
- d
- e
- o
- n
- /
- r
- v
- 6
- x
- x
- _
- d
- p
- m
- .
- c
- :
- 1
- 8
- 8
- 9
- s
- y
- s
- /
- d
- e
- v
- /
- d
- r
- m
- /
- r
- a
- d
- e
- o
- n
- /
- r
- v
- 6
- x
- x
- _
- d
- p
- m
- .
- c
- :
- 1
- 8
- 9
- 6
- s
- y
- s
- /
- d
- e
- v
- /
- d
- r
- m
- /
- r
- a
- d
- e
- o
- n
- /
- r
- v
- 6
- x
- x
- _
- d
- p
- m
- .
- c
- :
- 1
- 9
- 0
- 1
- s
- y
- s
- /
- d
- e
- v
- /
- d
- r
- m
- /
- r
- a
- d
- e
- o
- n
- /
- r
- v
- 6
- x
- x
- _
- d
- p
- m
- .
- c
- :
- 1
- 9
- 1
- 6
- s
- y
- s
- /
- d
- e
- v
- /
- d
- r
- m
- /
- r
- a
- d
- e
- o
- n
- /
- r
- v
- 6
- x
- x
- _
- d
- p
- m
- .
- c
- :
- 1
- 9
- 1
- 8
- s
- y
- s
- /
- d
- e
- v
- /
- d
- r
- m
- /
- r
- a
- d
- e
- o
- n
- /
- a
- t
- o
- m
- .
- h
- :
- 1
- 2
- 5
Detail
Exploit chain
none (not a memory-corruption primitive on this guest): radeon.ko not attached (no AMD GPU).
Evidence (decisive lines)
Source trace: rv6xx_dpm.c:1889,1896,1901,1916,1918 + atom.h:125 confirmed. Guest PCI: only QEMU stdvga. Fix compile-validated (3-file change: radeon.h, radeon_bios.c, rv6xx_dpm.c): radeon module rc=0 under -Werror.
PoC changes
Wrote fresh evidence pack under findings/poc/DF-1391/ plus git-apply-able fix.diff (3 files): adds uint32_t bios_size to struct radeon_device (radeon.h), populates it at all 5 rdev->bios allocation sites in radeon_bios.c, and validates every VBIOS-driven offset in rv6xx_parse_power_table against rdev->bios_size with an inval: error path.
Verified recommended fix
Add a bios_size field to struct radeon_device (radeon.h), populate it at every rdev->bios allocation in radeon_bios.c (5 sites: radeon_read_bios, radeon_read_platform_bios, radeon_read_pci_rom_bios, radeon_atrm_get_bios, radeon_acpi_vfct_bios), and add bounds checks in rv6xx_parse_power_table validating data_offset and every per-state offset against rdev->bios_size. supersedes finding proposal (which suggested adding bios_size to atom_context; this is equivalent but keeps the change local to the radeon driver).
Verdict
Source-confirmed. rv6xx_parse_power_table() at rv6xx_dpm.c:1889-1922 computes power_state/non_clock_info/clock_info pointers from VBIOS u16/u8 fields (usStateArrayOffset, usNonClockInfoArrayOffset, usClockInfoArrayOffset, ucStateEntrySize, ucNonClockSize, ucClockInfoSize, ucNonClockStateIndex, idx[j]) with NO bounds check vs the BIOS allocation. atom_context (atom.h:125) has no bios_size field, so the parser cannot detect OOB. Crafted VBIOS -> OOB heap read from the BIOS allocation. Sibling of DF-1333 (rv770 same pattern). HW-gated.
No comments yet.