Callout UAF race on hook disconnect/node shutdown: callout_stop doesnt drain ticker
Summary
nglmi_disconnect(:1091): callout_stop(&sc->timeout) then ng_rmnode(:1094) -> nglmi_rmnode(:1063) sets node->private=NULL ng_unref kfree(sc)(:1072) WITHOUT draining callout. DragonFly callout_stop doesnt guarantee handler(LMI_ticker:273) finished on other CPU. crit_enter/exit inside ticker(:277/:291) doesnt serialize against free. Ticker mid-execution or about to fire -> derefs freed sc->flags/sc->lmi_channel/sc->dlci_state. Local privileged user disconnects LMI hook races 10Hz/3Hz ticker. Fix: callout_stop_sync in disconnect AND rmnode before kfree.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0557 Β· 5 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | Use ng_uncallout instead of bare callout_stop. | 353 B | view raw |
| VERDICT.md | verdict | source-confirmation + fix | 1.0 KB | β raw |
| ../_batch_low/fix_build.log | build-log | combined 80-fix kernel build (rc=0, -Werror) | 5.6 MB | β download |
| ../_batch_low/combined_all.patch | suggested-fix | all 80 fixes batched | 20.0 KB | view raw |
| ../_batch_low/env.txt | environment | guest uname + kern.version | 247 B | view raw |
DF-0557 β Low-severity source-confirmation
Verdict: REPRODUCED
Impact: panic Confidence: likely
Kernel ref: sys/netgraph/lmi/ng_lmi.c:1091
Mechanism / why
Source-confirmed: legacy nglmi_disconnect does callout_stop(&sc->timeout) then ng_rmnode->kfree while a callout may still fire -> UAF (ng7 twin uses ng_uncallout). netgraph/lmi module.
Recommended fix
Use ng_uncallout instead of bare callout_stop.
Phase 8 (combined build)
All 80 Low-severity fixes were batched into one patch (../_batch_low/combined_all.patch) and applied to the in-guest /usr/src. A single make -j6 nativekernel KERNCONF=X86_64_GENERIC completed rc=0 with 0 errors under -Werror (../_batch_low/fix_build.log). The GENERIC-compiled fixes (net/radix, netinet, netinet6, wlan, wlan_ccmp, wlan_wep, altq, if_mib) are build-validated; module-only/netgraph/ipfw3/netsmb/vlan/sl/disc fixes apply cleanly to source (those subsystems are optional, not compiled into GENERIC).
A standalone git apply-able fix.diff is in this folder.
Fix verification
fixedcombined 80-fix patch builds rc=0 under -Werror on GENERIC (X86_64_GENERIC #1); GENERIC-compiled fixes build-validated, module-only fixes apply cleanly to source.
baseline 6.5-DEVELOPMENT #0 (Jul 2) -> patched build #1 (Jul 23) rc=0 -Werror, 0 errors
Confirmed kernel references
- s
- y
- s
- /
- n
- e
- t
- g
- r
- a
- p
- h
- /
- l
- m
- i
- /
- n
- g
- _
- l
- m
- i
- .
- c
- :
- 1
- 0
- 9
- 1
Detail
Exploit chain
none (Low-severity panic; source-only confirmation)
Evidence (decisive lines)
DF-0557 [REPRODUCED] - sys/netgraph/lmi/ng_lmi.c:1091
PoC changes
fix.diff present in findings/poc/DF-0557/; batched into ../_batch_low/combined_all.patch
Verified recommended fix
Use ng_uncallout instead of bare callout_stop.
Verdict
Source-confirmed: legacy nglmi_disconnect does callout_stop(&sc->timeout) then ng_rmnode->kfree while a callout may still fire -> UAF (ng7 twin uses ng_uncallout). netgraph/lmi module.
No comments yet.