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

Async-attach thread races driver deregistration/device deletion: device_t has no refcount and device_detach() short-circuits DS_INPROGRESS to success, allowing device_set_driver() to free the softc/kobj while device_attach_thread() is inside DEVICE_ATTACH()

Summary

With kern.do_async_attach=1 (non-default tunable) the attach thread runs DEVICE_ATTACH unsynchronized while device_t has no refcount: concurrent deregistration hits detach's state!=DS_ATTACHED -> return 0 short-circuit and frees the softc/kobj mid-attach - a UAF write into the freed device (nfe/em/emx opt into DF_ASYNCPROBE so the window is real when enabled). Not reachable on default config; honestly speculative/untested. refuse-DS_INPROGRESS fix proposed.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-5791 Β· 1 files
FileTypeDescriptionSize
verdict.json file 1020 B view raw

Fix verification

not_testable
baseline no→ patch + rebuild →patched clean
per-fix-DF-5791

Confirmed kernel references

Detail

Evidence (decisive lines)

static trace (DF-5789 rig carries the family proof)

Verified recommended fix

device_detach refuse DS_INPROGRESS (EBUSY)

Verdict

untested (speculative; needs kern.do_async_attach=1 + mid-attach deregistration race - not rig-economical per contract)