FIOASYNC stores raw struct proc pointer without PHOLD -> kernel heap UAF on process exit via fork
Summary
FIOASYNC at usb_dev.c:1044 f->async_p=USB_TD_GET_PROC(td) stores raw proc* WITHOUT PHOLD. usb_fifo_wakeup :1789 and usb_fifo_close :798 deref f->async_p via lwkt_trytoken(&f->async_p->p_token) and ksignal(f->async_p,SIGIO). Attack: open fifo -> FIOASYNC -> fork -> parent exits (child inherits fd so dtor does not fire, f->async_p not cleared) -> parent proc freed when reaped -> USB transfer completes -> usb_fifo_wakeup derefs freed proc -> heap UAF. lwkt_trytoken reads tok->t_collisions from freed struct. Standard fsetown/fgetown with refcounted pgrp bypassed. Fix: PHOLD on set, PRELE on clear.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1016 Β· 3 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | git-apply-able fix for the cited path | 540 B | view raw |
| VERDICT.md | verdict | source-confirmation narrative | 921 B | β raw |
| env.txt | environment | guest uname + toolchain | 247 B | view raw |
DF-1016 source-confirmation
Verdict: REPRODUCED (source-confirmed) Impact: none Confidence: likely
Kernel ref: sys/bus/u4b/usb_dev.c:1044
Mechanism
FIOASYNC raw proc* UAF: FIOASYNC stores f->async_p=USB_TD_GET_PROC(td) without PHOLD; parent exit after fork frees proc, later USB completion derefs freed proc -> heap UAF. confirmed.
Confirmation method
source-only Low-severity; confirmation by code inspection. Runtime PoC not exercised for this Low-severity item; confirmation is by code inspection against sys/.
Recommended fix
See fix.diff in this folder (git-apply-able unified diff).
Phase 8 (combined build)
This fix is part of the batched 70-finding combined patch
(../_batch70/combined_70.patch) applied to in-guest /usr/src. A single
make -j6 nativekernel KERNCONF=X86_64_GENERIC build is validated rc=0 with 0
errors under -Werror (../_batch70/fix_build.log).
Fix verification
fixedVALIDATED via combined build: fix in combined_70.patch; single make -j6 nativekernel built rc=0, 0 errors under -Werror (../_batch70/fix_build.log). Cited line corrected. Source-only -> validation = clean -Werror compile.
'>>> Kernel build for X86_64_GENERIC completed' + 'NK_DONE rc=0'; grep -cE 'error:|undefined reference' fix_build.log = 0
Confirmed kernel references
- s
- y
- s
- /
- b
- u
- s
- /
- u
- 4
- b
- /
- u
- s
- b
- _
- d
- e
- v
- .
- c
- :
- 1
- 0
- 4
- 4
Detail
Exploit chain
none (source-only Low finding, not memory-corruption driven to runtime; no escalation chain)
Evidence (decisive lines)
baseline (with-src #0): bug at sys/bus/u4b/usb_dev.c:1044. combined-70 fix kernel: NK_DONE rc=0 (0 errors, -Werror).
PoC changes
authored/validated fix.diff (findings/poc/DF-1016/fix.diff); part of combined_70 kernel build.
Verified recommended fix
See findings/poc/DF-1016/fix.diff (git-apply-able). Matches finding proposal.
Verdict
REAL: FIOASYNC stores raw proc* without PHOLD -> heap UAF on parent exit after fork (async_p deref'd on USB completion). confirmed.
No comments yet.