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

Unguarded divide by pp_table->FanMaximumRpm in vega20_fan_ctrl_get_fan_speed_percent

Summary

vega20_fan_ctrl_get_fan_speed_percent (vega20_thermal.c:129) computes percent = current_rpm * 100 / pp_table->FanMaximumRpm with NO zero-guard on uint16_t FanMaximumRpm. If SMC PPTable field is 0 (corrupt/malformed VBIOS, fanless SKU misconfiguration, transient zero during early init / firmware fault) any read of fan-speed-percent sysfs path panics. Sibling set_fan_speed_percent guards duty100==0 (line 153) but this read path does not. pp_table->FanMaximumRpm populated from VBIOS at vega20_processpptables.c:815 and overridable via OD8 at vega20_hwmgr.c:1297 neither guarantees non-zero. Reachable: amdgpu_hwmon_get_pwm1 -> amdgpu_dpm_get_fan_speed_percent -> pp_dpm_get_fan_speed_percent -> hwmgr_func->get_fan_speed_percent (vega20_hwmgr.c:3581). Trigger: cat /sys/class/hwmon/hwmonN/pwm1 on board with FanMaximumRpm==0. AV:L/AC:H/PR:L, A:H.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2036 Β· 3 files
FileTypeDescriptionSize
VERDICT.md verdict Source-confirmation verdict for DF-2036 617 B ↓ raw
fix.diff suggested-fix Guard FanMaximumRpm==0 in get_fan_speed_percent 697 B view raw
../fix_build.log build-log Batch kernel build log (all fixes, rc=0) 5.6 MB ↓ download
VERDICT.md verdict Source-confirmation verdict for DF-2036
↓ download raw

DF-2036 Verification Verdict

Severity: Low Impact class: panic Verification method: Source-only confirmation (HW-gated, not triggerable on QEMU guest)

Verdict: REPRODUCED (source-confirmed)

The bug is confirmed in the audited source at the cited path:line. Triggerable but requires specific driver/config.

Fix: Guard FanMaximumRpm==0 in get_fan_speed_percent

Fix applied and validated in batch kernel build (rc=0, -Werror).

Fix validation

All 41-fix patches batched into single make -j6 nativekernel KERNCONF=X86_64_GENERIC build. Build result: rc=0, 0 errors (full -Werror clean).

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

VALIDATED: 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.
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

REPRODUCED (source-only): vega20_fan_ctrl_get_fan_speed_percent computes percent = current_rpm*100/pp_table->FanMaximumRpm with NO zero-guard on uint16_t FanMaximumRpm. Corrupt VBIOS field 0 -> #DE pa

Verified recommended fix

REPRODUCED (source-only): vega20_fan_ctrl_get_fan_speed_percent computes percent = current_rpm*100/pp_table->FanMaximumRpm with NO zero-guard on uint16_t FanMaximumRpm. Corrupt VBIOS field 0 -> #DE panic.

Verdict

REPRODUCED (source-only): vega20_fan_ctrl_get_fan_speed_percent computes percent = current_rpm*100/pp_table->FanMaximumRpm with NO zero-guard on uint16_t FanMaximumRpm. Corrupt VBIOS field 0 -> #DE panic.