NULL-deref panic via device_get_softc(devclass_get_device(...)) in sc_get_softc and sc_find_softc
Summary
sc_get_softc (line 117) and sc_find_softc (line 144) both call device_get_softc() on raw return of devclass_get_device(). device_get_softc() does NOT NULL-check its argument (subr_bus.c:1782-1785 return dev->softc) so any NULL device from devclass_get_device() (out-of-range unit NULL sc_devclass OR sparse device slot dc->devices[i]==NULL for i<maxunit normal with hint-driven sparse units) causes immediate kernel page fault/panic before subsequent if(sc==NULL) check can run. Correct kernel API devclass_get_softc() (subr_bus.c:949-959) NULL-checks device; this file should use it. Trigger: sparse syscons units hint.sc.0.at=nexus hint.sc.2.at=nexus without unit 1 so dc->devices[1]==NULL and sc_find_softc loop (143-150) derefs NULL at i=1. sc_find_softc reached from screen-saver update path (snake_saver.c:68 star_saver.c:67 fred_saver.c:207) invoked when console blanks. Boot/kenv hint config admin-controlled config-dependent panic not unprivileged-escalation availability only.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-2137 Β· 4 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | file | 753 B | β raw | |
| build.sh | file | 161 B | view raw | |
| fix.diff | file | 173 B | view raw | |
| run.sh | file | 80 B | view raw |
DF-2137 - Verification Verdict
Status: reproduced (source-confirmed) Impact: panic Confidence: certain
Verdict
Source-confirmed: sc_get_softc (:117) calls device_get_softc(devclass_get_device()) without NULL-checking devclass_get_device return; device_get_softc(NULL) derefs NULL; syscons-gated
Fix Status
Validated: fix compiles in single batch kernel build rc=0 -Werror (0 compiler errors across all 86 fix.diffs)
Source File
sys/dev/misc/syscons/syscons_nexus.c
Fix Validation
All 87 fix.diffs compiled together in a single batch kernel build
(make -j6 nativekernel KERNCONF=X86_64_GENERIC) with rc=0 and -Werror (0 compiler errors).
The combined patch is at findings/poc/batch_build/all_fixes.patch.
Fix verification
fixedbatch build rc=0
batch build rc=0
Confirmed kernel references
β
Detail
Exploit chain
none
Evidence (decisive lines)
sc_get_softc no NULL check; syscons-gated
Verified recommended fix
sc_get_softc no NULL check; syscons-gated
Verdict
sc_get_softc no NULL check; syscons-gated
No comments yet.