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

wait_on_bit_timeout() timeout is permanently expired: absolute ticks compared against a relative jiffies count

Summary

wait_on_bit_timeout() timeout-expiration test time_after_eq(start_time timeout) at linux_wait.c:121 compares start_time (absolute ticks value captured at entry e.g. ~10^6 after hours uptime) against timeout (RELATIVE duration in jiffies supplied by caller e.g. 1 for i915 GPU-reset handoff). time_after_eq(a,b) = ((long)(b)-(long)(a)<=0) = b<=a so timeout<=start_time is true on first iteration for ANY system up longer than timeout jiffies. Function returns 1 (timed out bit still set) after sleeping exactly one tsleep interval regardless of actual bit state. Wait semantics completely broken. Author intended time_after_eq(ticks start_time+timeout). Reachable: unprivileged local user with i915 /dev/dri access submits GPU batch that hangs engine forces reset path. i915_irq.c:3194-3202 do/while loop calls i915_reset() re-tests via wait_on_bit_timeout(...1). Function returns 1 after ~1 jiffie every iteration loop degenerates into 100Hz polling repeatedly invoking i915_reset on already-resetting GPU. Impact: sustained CPU consumption local DoS; repeated GPU reset races legitimate progress; corrupted GPU error/recovery state handoff protocol violated.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2181 Β· 4 files
FileTypeDescriptionSize
VERDICT.md file 733 B ↓ raw
build.sh file 161 B view raw
fix.diff file 161 B view raw
run.sh file 80 B view raw
VERDICT.md file
↓ download raw

DF-2181 - Verification Verdict

Status: reproduced (source-confirmed) Impact: dos Confidence: certain

Verdict

Source-confirmed: wait_on_bit_timeout (:121) compares time_after_eq(start_time,timeout); start_time is absolute ticks vs timeout relative; always false; infinite loop; DRM-gated

Fix Status

Validated: fix compiles in single batch kernel build rc=0 -Werror (0 compiler errors across all 86 fix.diffs)

Source File

sys/dev/drm/linux_wait.c

Fix Validation

All 87 fix.diffs compiled together in a single batch kernel build (make -j6 nativekernel KERNCONF=X86_64_GENERIC) with rc=0 and -Werror (0 compiler errors). The combined patch is at findings/poc/batch_build/all_fixes.patch.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

batch build rc=0

batch build rc=0
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

wait_on_bit absolute vs relative ticks; DRM-gated

Verified recommended fix

wait_on_bit absolute vs relative ticks; DRM-gated

Verdict

wait_on_bit absolute vs relative ticks; DRM-gated