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

Zero-stride VBIOS record walks never terminate: radeon_atom_init_mc_reg_table and atom_lookup_voltage_object_v3 infinite loops

Summary

The MC reg-data walk advances by usRegDataBlkSize (BIOS u16): stride 0 with a mem-id mismatch makes both loop conditions unreachable -> permanent kernel loop at DPM init; a nonzero stride walks unbounded past the VBIOS image until it happens to read 0xFFFFFFFF. atom_lookup_voltage_object_v3 advances by the object's self-declared usSize - usSize==0 with a type/mode mismatch loops forever. HARNESS: both replicas hit a 2^24-iteration harness cap; stride-4 control with END marker terminates in 3. Crafted VBIOS hangs the kernel at attach. Fix: reject zero stride + minimum-size break.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-3741 Β· 13 files
FileTypeDescriptionSize
README.md β€” 2.1 KB ↓ raw
VERDICT.md β€” 2.6 KB ↓ raw
build.log β€” 0 B ↓ download
build.sh β€” 65 B view raw
env.txt β€” 375 B view raw
harness_hang.c β€” 4.3 KB view raw
run.log β€” 461 B view raw
run.sh β€” 108 B view raw
README.md β€” 2.1 KB ↓ raw
VERDICT.md β€” 2.6 KB ↓ raw
manifest.json β€” 912 B view raw
verdict.json β€” 3.0 KB view raw
fix.diff β€” 1.1 KB view raw

DF-3741 β€” Zero-stride VBIOS record walks cause infinite kernel loops (radeon_atom_init_mc_reg_table, atom_lookup_voltage_object_v3)

Severity: Medium Β· CWE: CWE-835 Loop with Unreachable Exit Condition Β· File: sys/dev/drm/radeon/radeon_atombios.c:4023-4045, 3423-3429

What this is

Two BIOS-gated infinite loops (kernel hang at driver init / first DPM use): (1) radeon_atom_init_mc_reg_table():4023-4045 walks reg_data in usRegDataBlkSize strides; with a BIOS stride of 0 and mem-id mismatch, neither the END sentinel nor the num_ranges<VBIOS_MAX_AC_TIMING_ENTRIES cap can ever trigger β€” non-terminating loop; with a nonzero stride the walk scans unbounded past the VBIOS image heap until it stumbles on 0xFFFFFFFF (OOB read). (2) atom_lookup_voltage_object_v3():3423-3429 advances by the object's self-declared usSize; usSize==0 with a type/mode mismatch never advances β€” non-terminating. Harness on guest: both replicas fail to terminate within 2^24 iterations (the cap exists only in the harness); a stride-4 control with an END marker terminates in 3. Same source certainty as pass-1 class but distinct functions; no AMD hardware on this guest.

Reproduce

./build.sh    # cc -O1 -g -Wall -o <bin> harness_hang.c   (DragonFly guest, cc 8.3)
./run.sh      # expected: both zero-stride walks hit the 2^24-iteration harness cap (non-termination); control terminates in 3; exit_code=0

The harness replicates the kernel parse arithmetic VERBATIM (cited path:line) against a synthetic crafted-VBIOS buffer with canary-guarded destinations.

Guest / environment

Guest has NO AMD/radeon GPU (virtio-only); /boot/kernel/radeon.ko exists (code shipped in the default install) but cannot attach, so the kernel code path is unreachable at runtime on this guest. Evidence is source-level certainty (path:line traced) plus a verbatim-arithmetic userland harness compiled and executed on the guest (build.log/run.log). See env.txt (uname, cc, kldstat, /boot/kernel/radeon.ko presence).

Fix

reject zero strides β€” see fix.diff (authored after verification; never applied to sys/).

DF-3741 β€” Zero-stride VBIOS record walks cause infinite kernel loops (radeon_atom_init_mc_reg_table, atom_lookup_voltage_object_v3)

Severity: Medium Β· CWE: CWE-835 Loop with Unreachable Exit Condition Β· File: sys/dev/drm/radeon/radeon_atombios.c:4023-4045, 3423-3429

What this is

Two BIOS-gated infinite loops (kernel hang at driver init / first DPM use): (1) radeon_atom_init_mc_reg_table():4023-4045 walks reg_data in usRegDataBlkSize strides; with a BIOS stride of 0 and mem-id mismatch, neither the END sentinel nor the num_ranges<VBIOS_MAX_AC_TIMING_ENTRIES cap can ever trigger β€” non-terminating loop; with a nonzero stride the walk scans unbounded past the VBIOS image heap until it stumbles on 0xFFFFFFFF (OOB read). (2) atom_lookup_voltage_object_v3():3423-3429 advances by the object's self-declared usSize; usSize==0 with a type/mode mismatch never advances β€” non-terminating. Harness on guest: both replicas fail to terminate within 2^24 iterations (the cap exists only in the harness); a stride-4 control with an END marker terminates in 3. Same source certainty as pass-1 class but distinct functions; no AMD hardware on this guest.

Reproduce

./build.sh    # cc -O1 -g -Wall -o <bin> harness_hang.c   (DragonFly guest, cc 8.3)
./run.sh      # expected: both zero-stride walks hit the 2^24-iteration harness cap (non-termination); control terminates in 3; exit_code=0

The harness replicates the kernel parse arithmetic VERBATIM (cited path:line) against a synthetic crafted-VBIOS buffer with canary-guarded destinations.

Guest / environment

Guest has NO AMD/radeon GPU (virtio-only); /boot/kernel/radeon.ko exists (code shipped in the default install) but cannot attach, so the kernel code path is unreachable at runtime on this guest. Evidence is source-level certainty (path:line traced) plus a verbatim-arithmetic userland harness compiled and executed on the guest (build.log/run.log). See env.txt (uname, cc, kldstat, /boot/kernel/radeon.ko presence).

Fix

reject zero strides β€” see fix.diff (authored after verification; never applied to sys/).

VERDICT.md
↓ download raw

VERDICT β€” DF-3741

Status: inconclusive (source-certain; harness-reproduced arithmetic; kernel path unreachable on this guest) reproduced: 0 (in-kernel) β€” harness demonstration: YES Impact on real hardware: Medium β€” CWE-835 Loop with Unreachable Exit Condition

Finding

Two BIOS-gated infinite loops (kernel hang at driver init / first DPM use): (1) radeon_atom_init_mc_reg_table():4023-4045 walks reg_data in usRegDataBlkSize strides; with a BIOS stride of 0 and mem-id mismatch, neither the END sentinel nor the num_ranges<VBIOS_MAX_AC_TIMING_ENTRIES cap can ever trigger β€” non-terminating loop; with a nonzero stride the walk scans unbounded past the VBIOS image heap until it stumbles on 0xFFFFFFFF (OOB read). (2) atom_lookup_voltage_object_v3():3423-3429 advances by the object's self-declared usSize; usSize==0 with a type/mode mismatch never advances β€” non-terminating. Harness on guest: both replicas fail to terminate within 2^24 iterations (the cap exists only in the harness); a stride-4 control with an END marker terminates in 3. Same source certainty as pass-1 class but distinct functions; no AMD hardware on this guest.

Why not reproduced in-kernel

The QEMU guest is virtio-only (no AMD GPU): pciconf -l shows no 1002 device; kldstat shows radeon not loaded. /boot/kernel/radeon.ko exists (the vulnerable code ships in the default install) but cannot attach, so radeon_atombios.c parse paths never execute here. All conclusions are source-level (path:line above) plus the on-guest harness (harness_hang.c).

Harness result

Command: ./run.sh (after ./build.sh) Expected/observed: both zero-stride walks hit the 2^24-iteration harness cap (non-termination); control terminates in 3; exit_code=0 Full logs: build.log, run.log.

Impact / exploit chain

crafted VBIOS (VRAM_Info frev2/crev1 with usRegDataBlkSize=0, or VoltageObjectInfo v3 object with usSize=0) -> kldload/boot hangs the kernel in a tight loop -> local DoS (requires VBIOS control)

Fix

reject zero strides β€” fix.diff.

Honest notes

  • DF-3741 does NOT re-report pass-1 findings DF-1198/1199/1200 (power-table state_index mismatch, asic_ss_info underflow, power-table indices) β€” different functions/tables/fields.
  • fix validation not possible on this guest (no hardware); fix.diff is source-authored only.

Fix status (batch validation)

Applied with the 36 sibling fix.diffs of this batch in findings/poc/_batch41/all_fixes.patch; single in-guest make -j6 nativekernel KERNCONF=X86_64_GENERIC completed RC=0 with zero errors under -Werror (full log: findings/poc/_batch41/fix_build8.log). Behavior A/B intentionally skipped for this Info-tier item.

VERDICT.md
↓ download raw

VERDICT β€” DF-3741

Status: inconclusive (source-certain; harness-reproduced arithmetic; kernel path unreachable on this guest) reproduced: 0 (in-kernel) β€” harness demonstration: YES Impact on real hardware: Medium β€” CWE-835 Loop with Unreachable Exit Condition

Finding

Two BIOS-gated infinite loops (kernel hang at driver init / first DPM use): (1) radeon_atom_init_mc_reg_table():4023-4045 walks reg_data in usRegDataBlkSize strides; with a BIOS stride of 0 and mem-id mismatch, neither the END sentinel nor the num_ranges<VBIOS_MAX_AC_TIMING_ENTRIES cap can ever trigger β€” non-terminating loop; with a nonzero stride the walk scans unbounded past the VBIOS image heap until it stumbles on 0xFFFFFFFF (OOB read). (2) atom_lookup_voltage_object_v3():3423-3429 advances by the object's self-declared usSize; usSize==0 with a type/mode mismatch never advances β€” non-terminating. Harness on guest: both replicas fail to terminate within 2^24 iterations (the cap exists only in the harness); a stride-4 control with an END marker terminates in 3. Same source certainty as pass-1 class but distinct functions; no AMD hardware on this guest.

Why not reproduced in-kernel

The QEMU guest is virtio-only (no AMD GPU): pciconf -l shows no 1002 device; kldstat shows radeon not loaded. /boot/kernel/radeon.ko exists (the vulnerable code ships in the default install) but cannot attach, so radeon_atombios.c parse paths never execute here. All conclusions are source-level (path:line above) plus the on-guest harness (harness_hang.c).

Harness result

Command: ./run.sh (after ./build.sh) Expected/observed: both zero-stride walks hit the 2^24-iteration harness cap (non-termination); control terminates in 3; exit_code=0 Full logs: build.log, run.log.

Impact / exploit chain

crafted VBIOS (VRAM_Info frev2/crev1 with usRegDataBlkSize=0, or VoltageObjectInfo v3 object with usSize=0) -> kldload/boot hangs the kernel in a tight loop -> local DoS (requires VBIOS control)

Fix

reject zero strides β€” fix.diff.

Honest notes

  • DF-3741 does NOT re-report pass-1 findings DF-1198/1199/1200 (power-table state_index mismatch, asic_ss_info underflow, power-table indices) β€” different functions/tables/fields.
  • fix validation not possible on this guest (no hardware); fix.diff is source-authored only.

Fix status (batch validation)

Applied with the 36 sibling fix.diffs of this batch in findings/poc/_batch41/all_fixes.patch; single in-guest make -j6 nativekernel KERNCONF=X86_64_GENERIC completed RC=0 with zero errors under -Werror (full log: findings/poc/_batch41/fix_build8.log). Behavior A/B intentionally skipped for this Info-tier item.

Fix verification

not_testable
baseline no→ patch + rebuild →patched clean

fix.diff authored after source-level verification; cannot be validated on this guest (no AMD GPU; radeon.ko cannot attach). Compiling the module or booting a patched kernel would not exercise the path without hardware.

fix.diff (unified, against read-only sys/ tree; never applied)
↓ fix.diffper-fix-DF-3741

Confirmed kernel references

Detail

Exploit chain

crafted VBIOS (VRAM_Info frev2/crev1 with usRegDataBlkSize=0, or VoltageObjectInfo v3 object with usSize=0) -> kldload/boot hangs the kernel in a tight loop -> local DoS (requires VBIOS control)

Evidence (decisive lines)

harness_hang.c + build.log + run.log; VERDICT.md; kernel refs sys/dev/drm/radeon/radeon_atombios.c:4023-4045

PoC changes

harness written from scratch (no seed PoC): verbatim kernel arithmetic replica with canary-guarded destination model, built and executed on the DragonFly guest (cc 8.3); fixed nested-comment, stddef/stdint includes and volatile divisors during bring-up

Verified recommended fix

reject zero strides

Verdict

Two BIOS-gated infinite loops (kernel hang at driver init / first DPM use): (1) radeon_atom_init_mc_reg_table():4023-4045 walks reg_data in usRegDataBlkSize strides; with a BIOS stride of 0 and mem-id mismatch, neither the END sentinel nor the num_ranges<VBIOS_MAX_AC_TIMING_ENTRIES cap can ever trigger β€” non-terminating loop; with a nonzero stride the walk scans unbounded past the VBIOS image heap until it stumbles on 0xFFFFFFFF (OOB read). (2) atom_lookup_voltage_object_v3():3423-3429 advances by the object's self-declared usSize; usSize==0 with a type/mode mismatch never advances β€” non-terminating. Harness on guest: both replicas fail to terminate within 2^24 iterations (the cap exists only in the harness); a stride-4 control with an END marker terminates in 3. Same source certainty as pass-1 class but distinct functions; no AMD hardware on this guest.