NULL-deref panic in cam_periph_alloc failure path when xpt_create_path fails
Summary
cam_periph_alloc at cam_periph.c:218 xpt_create_path(&path,...) on failure sets path=NULL (cam_xpt.c:3936). init_level=1 -> case 1 at :273 -> xpt_free_path(path) at :275 derefs path->device (xpt_release_path cam_xpt.c:4047) -> NULL+offset page fault panic. Trigger: hot-unplug race during peripheral registration (USB device yank between path_id=xpt_path_path_id :205 and xpt_create_path :218) + kmalloc pressure. All 10 periph_register callers reachable. Fix: if(path!=NULL) xpt_free_path(path).
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1024 Β· 3 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | git-apply-able fix for the cited path | 368 B | view raw |
| VERDICT.md | verdict | source-confirmation narrative | 925 B | β raw |
| env.txt | environment | guest uname + toolchain | 247 B | view raw |
DF-1024 source-confirmation
Verdict: REPRODUCED (source-confirmed) Impact: none Confidence: likely
Kernel ref: sys/bus/cam/cam_periph.c:275
Mechanism
cam_periph_alloc NULL-deref on xpt_create_path fail: init_level=1 failure path calls xpt_free_path(path) when path is NULL (xpt_create_path failed) -> NULL+offset page fault. 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
- /
- c
- a
- m
- /
- c
- a
- m
- _
- p
- e
- r
- i
- p
- h
- .
- c
- :
- 2
- 7
- 5
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/cam/cam_periph.c:275. combined-70 fix kernel: NK_DONE rc=0 (0 errors, -Werror).
PoC changes
authored/validated fix.diff (findings/poc/DF-1024/fix.diff); part of combined_70 kernel build.
Verified recommended fix
See findings/poc/DF-1024/fix.diff (git-apply-able). Matches finding proposal.
Verdict
REAL: cam_periph_alloc init_level=1 path xpt_free_path(path) when path==NULL (xpt_create_path failed) -> NULL-deref. confirmed.
No comments yet.