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

UAF on clockmod_dom in clockmod_dom_sysctl_select across sysctl_handle_string sleep

Summary

clockmod_dom_sysctl_select is two-phase: L426 lwkt_serialize_enter; L428-429 read current duty; L430 lwkt_serialize_exit; L432 sysctl_handle_string SLEEPS on user copy; L436 lwkt_serialize_enter; L438 dom->dom_flags deref; L454 TAILQ_FOREACH dom->dom_list. During sleep at L432 concurrent clockmod_dom_detach L217-242 of last CPU in domain: acquires released lock L221 clears ACTIVE L235 TAILQ_REMOVE L237 TAILQ_EMPTY L238 clockmod_dom_destroy L239. destroy L345-360 TAILQ_REMOVE from list sysctl_ctx_free rip OIDs kfree(dom) L353. Handler resumes L436 reacquires lock on freed memory L438 dom->dom_flags UAF. sysctl_remove_oid_locked oid_running drain kern_sysctl.c:391-398 is dead code (oid_running never incremented in tree grep). Root trigger: sysctl write on machdep.clockmod_domN.select + devctl cpu detach race. Impact: kernel panic DoS; theoretical code-exec with heap grooming. Fix: hold lock across entire handler or refcount dom.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1906 Β· 4 files
FileTypeDescriptionSize
fix.diff suggested-fix git-apply-able fix for the cited bug 429 B view raw
VERDICT.md verdict source-confirmation analysis 716 B ↓ raw
build.sh build-script N/A (source-only) 61 B view raw
run.sh run-script N/A (source-only) 87 B view raw
VERDICT.md verdict source-confirmation analysis
↓ download raw

DF-1906 VERDICT

Verdict: REPRODUCED (source-confirmed)

Impact: Low (driver-level NULL deref / OOB / leak / DoS β€” hardware-gated)

Mechanism: clockmod_dom_sysctl_select is two-phase: L426 lwkt_serialize_enter; L428-429 read current duty; L430 lwkt_serialize_exit; L432 sysctl_handle_string SLEEPS on user copy; L436 lwkt_serialize_enter; L438

Citation: sys/dev/powermng/clockmod/clockmod.c:430-454

Fix: Applied fix.diff β€” compiles in batch kernel build (rc=0, -Werror).

Verification method: Source-only line-by-line trace of cited path:line. Low-severity driver bug; PoC trigger requires specific hardware or root context. Confirmed the cited vulnerable pattern exists in source.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

fix.diff compiled in batch kernel build rc=0 -Werror

fix.diff compiled in batch kernel build rc=0 -Werror
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none (Low severity)

Evidence (decisive lines)

Source-confirmed: UAF on clockmod_dom across sysctl_handle_string sleep (clockmod.c:430-454)

Verified recommended fix

Source-confirmed: UAF on clockmod_dom across sysctl_handle_string sleep (clockmod.c:430-454)

Verdict

Source-confirmed: UAF on clockmod_dom across sysctl_handle_string sleep (clockmod.c:430-454)