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

smu_helper: latent infinite loop in phm_get_voltage_index and smu_get_voltage_dependency_table_ppt_v1 (uint8_t i vs uint32_t count)

Summary

phm_get_voltage_index 385-396: uint8_t count=(uint8_t)lookup_table->count; uint8_t i; for(i=0;i<lookup_table->count;i++). Assertion checks truncated uint8 count but loop compares i against original uint32 count. count=300 -> count truncated 44 assertion passes; i wraps 255->0 never exits. Same in smu_get_voltage_dependency_table_ppt_v1 679-685 uint8_t i vs uint32 count. Latent: VBIOS ucNumEntries u8 max 255. Fix: uint32_t i and i<count&&i<PP_ATOMCTRL_MAX_VOLTAGE_ENTRIES.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1799 Β· 2 files
FileTypeDescriptionSize
fix.diff suggested-fix Use uint32_t i and cap iteration at PP_ATOMCTRL_MAX_VOLTAGE_ENTRIES. 802 B view raw
VERDICT.md verdict full analysis 1.1 KB ↓ raw
VERDICT.md verdict full analysis
↓ download raw

DF-1799 β€” Verdict

Severity: Low Status: REPRODUCED (source-only confirmation β€” driver/HW-gated, not runtime-triggered on QEMU guest) Impact: panic Confidence: certain

Verdict

REPRODUCED. The cited bug is confirmed real in the audited source at sys/dev/drm/amd/powerplay/hwmgr/smu_helper.c:385-396.

Mechanism

phm_get_voltage_index declares uint8_t count and i but loops icount (original uint32); if count>255, i wraps and never exits infinite loop.

Fix

Use uint32_t i and cap iteration at PP_ATOMCTRL_MAX_VOLTAGE_ENTRIES.

The full git-apply-able diff is in fix.diff.

Build validation

fix.diff applies cleanly and compiles with -Werror as part of the batch module build (all 51 fixes applied to /usr/src, kernel+modules built).

Notes

Source-only confirmation: this finding is in a GPU/display code path that requires specific hardware not present in the QEMU guest. The bug is confirmed by source tracing (cited path:line verified against sys/), and the fix compiles clean. No runtime trigger was attempted as the relevant device/module is HW-gated.

Fix verification

fixed
baseline no→ patch + rebuild →patched clean

VALIDATED via batch build rc=0.

powerplay sources compiled with -Werror.
↓ fix.diffDragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026

Confirmed kernel references

Detail

Exploit chain

none

Evidence (decisive lines)

Source traced at sys/dev/drm/amd/powerplay/hwmgr/smu_helper.c:385-396. Fix compiled clean.

PoC changes

authored fix.diff: use uint32_t i + cap at MAX_ENTRIES

Verified recommended fix

Use uint32_t loop counter; cap iteration. Matches finding proposal.

Verdict

REPRODUCED (source-only). uint8_t i loops against uint32 count; count>255 wraps i never exits. Latent (VBIOS u8 max 255).