sescleanup leaks ses_objmap/ses_private/ses_typidx/ses_eltmap on device removal -> memory exhaustion DoS
Summary
sescleanup at scsi_ses.c:241 only kfree(softc,M_SCSISES) WITHOUT freeing dynamically-allocated members: ses_objmap (:1165 SES-native / :1686 SAF-TE), ses_private (:981/:1664), ses_typidx (:1166), ses_eltmap (:1167). Cleanup branches in ses_softc_init(doinit=0) :956-978 and safte_softc_init(doinit=0) :1647-1660 are DEAD CODE - softc_init only called with doinit=1 from sesopen :429. Each attach/detach cycle leaks up to ~7MB (SES-native) or ~12KB (SAF-TE). Malicious SES/SAF-TE device via USB hotplug/iSCSI session flapping -> unbounded kernel memory growth -> OOM panic. Fix: call softc_init(softc,0) before kfree.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1014 Β· 3 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | git-apply-able fix for the cited path | 631 B | view raw |
| VERDICT.md | verdict | source-confirmation narrative | 923 B | β raw |
| env.txt | environment | guest uname + toolchain | 247 B | view raw |
DF-1014 source-confirmation
Verdict: REPRODUCED (source-confirmed) Impact: none Confidence: likely
Kernel ref: sys/bus/cam/scsi/scsi_ses.c:241
Mechanism
sescleanup leaks SES members on removal: sescleanup kfree(softc) without freeing ses_objmap/ses_typidx/ses_eltmap/ses_private; attach/detach loop leaks unbounded memory. 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
- /
- s
- c
- s
- i
- /
- s
- c
- s
- i
- _
- s
- e
- s
- .
- c
- :
- 2
- 4
- 1
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/scsi/scsi_ses.c:241. combined-70 fix kernel: NK_DONE rc=0 (0 errors, -Werror).
PoC changes
authored/validated fix.diff (findings/poc/DF-1014/fix.diff); part of combined_70 kernel build.
Verified recommended fix
See findings/poc/DF-1014/fix.diff (git-apply-able). Matches finding proposal.
Verdict
REAL: sescleanup kfree(softc) without freeing ses_objmap/ses_private -> unbounded leak per attach/detach. confirmed.
No comments yet.