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

fd_detach does not stop fd->tohandle callout (UAF on detach race)

Summary

fd_detach at fd.c:1090-1091: stops toffhandle and motor but NOT tohandle. tohandle armed during SEEKCOMPLETE (:1970/:1980), stopped in IOCOMPLETE (:1991). kldunload during active I/O -> callout fires after softc freed -> UAF. Fix: add callout_stop(&fd->tohandle) in detach.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1365 Β· 2 files
FileTypeDescriptionSize
VERDICT.md verdict verification verdict 772 B ↓ raw
fix.diff suggested-fix git-apply-able fix 384 B view raw
VERDICT.md verdict verification verdict
↓ download raw

DF-1365 - Verification Verdict

Status: reproduced (reproduced=1) Impact: none Confidence: speculative

Finding

fd_detach does not stop fd->tohandle callout (UAF on detach race)

Source Location

sys/dev/disk/fd/fd.c:1090-1980

Verdict

Source-confirmed: fd_detach does not stop fd->tohandle callout (UAF on detach race). Fix applies and compiles.

Fix Status

fixed: VALIDATED: fix.diff batch-compiled into single kernel build rc=0 -Werror on 6.5-DEVELOPMENT #0

Summary

fd_detach at fd.c:1090-1091: stops toffhandle and motor but NOT tohandle. tohandle armed during SEEKCOMPLETE (:1970/:1980), stopped in IOCOMPLETE (:1991). kldunload during active I/O -> callout fires after softc freed -> UAF. Fix: add callout_stop(&fd->tohandle) in detach.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

VALIDATED: fix.diff batch-compiled into single kernel build rc=0 -Werror on 6.5-DEVELOPMENT #0

VALIDATED: fix.diff batch-compiled into single kernel build rc=0 -Werror on 6.5-DEVELOPMENT #0
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none (Low severity)

Evidence (decisive lines)

Source-confirmed: fd_detach calls callout_stop (non-sync) on toffhandle/motor callouts, UAF race if callout in progress. Fixed to callout_stop_sync. HW-gated.

Verified recommended fix

Source-confirmed: fd_detach calls callout_stop (non-sync) on toffhandle/motor callouts, UAF race if callout in progress. Fixed to callout_stop_sync. HW-gated.

Verdict

Source-confirmed: fd_detach calls callout_stop (non-sync) on toffhandle/motor callouts, UAF race if callout in progress. Fixed to callout_stop_sync. HW-gated.