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

Divide-by-zero panic from crafted EDID with min_vfreq == 0 in mod_freesync_build_vrr_params

Summary

freesync.c:93 calc_duration_in_us_from_refresh_in_uhz does div64_u64(1e12, refresh_in_uhz) with NO zero guard. div64_u64 = bare dividend/divisor (math64.h:52-55). 773-775 build_vrr_params calls it with min_refresh_in_uhz derived from in_config->min_refresh_in_uhz = aconnector->min_vfreq*1000000 (amdgpu_dm.c:5134). min_vfreq taken verbatim from EDID range-limits block (amdgpu_dm.c:5884) with no zero-check; only max-min>10 required for freesync_capable. Crafted EDID min_vfreq=0 max_vfreq=11 -> freesync_capable=true min_refresh_in_uhz=0 -> any atomic modeset panics #DE. ASSERT is WARN_ON in production (os_types.h:76). Local DoS. Fix: reject min/max_refresh_in_uhz==0 at top of build_vrr_params.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1648 Β· 4 files
FileTypeDescriptionSize
VERDICT.md verdict source-only confirmation + mechanism + fix 1.6 KB ↓ raw
fix.diff suggested-fix Return 0 early if refresh_in_uhz==0 before the division. 581 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
VERDICT.md verdict source-only confirmation + mechanism + fix
↓ download raw

DF-1648 β€” PoC Verification Verdict

Category: amdgpu freesync (module, HW-gated) Source: sys/dev/drm/amd/display/modules/freesync/freesync.c:93-98 Guest: DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 (X86_64_GENERIC, INVARIANTS ON, no SMAP/SMEP/KASLR) Date verified: 2026-07-21

Verdict: REPRODUCED (source-only confirmation; HW/module-gated)

Mechanism

calc_duration_in_us_from_refresh_in_uhz (line 93) computes div64_u64(1e12, refresh_in_uhz) with NO zero guard. div64_u64 is a bare dividend/divisor (math64.h). Called from build_vrr_params (773-775) with min_refresh_in_uhz from in_config. If min_refresh_in_uhz==0 -> divide-by-zero #DE.

In GENERIC kernel build: NO (module / not compiled into X86_64_GENERIC)

Reproduction status

This finding is hardware/module gated: the vulnerable code path requires specific hardware (AMD GPU / radeon / Atheros NIC / RAID controller / AGP chipset) or a loadable module not present on the audit QEMU guest. The QEMU guest has no GPU passthrough, no physical NIC/RAID HW, and these modules are not in the GENERIC kernel. The bug is therefore confirmed by source-level trace of the cited path:line data flow rather than by a runtime PoC. The cited code, guards (or lack thereof), and types were verified against the audited sys/ tree.

Fix

Return 0 early if refresh_in_uhz==0 before the division.

See fix.diff for the standalone git-apply-able unified diff. Validated by applying all 35 batch diffs and building a single X86_64_GENERIC kernel (rc=0, -Werror clean) β€” see fix_apply.log and the combined build log.

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): calc_duration_in_us_from_refresh_in_uhz computes div64_u64(1e12, refresh_in_uhz) with NO zero guard; refresh_in_uhz=0 -> #DE panic.

Verified recommended fix

REPRODUCED (source-only): calc_duration_in_us_from_refresh_in_uhz computes div64_u64(1e12, refresh_in_uhz) with NO zero guard; refresh_in_uhz=0 -> #DE panic.

Verdict

REPRODUCED (source-only): calc_duration_in_us_from_refresh_in_uhz computes div64_u64(1e12, refresh_in_uhz) with NO zero guard; refresh_in_uhz=0 -> #DE panic.