β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-2185

backlight_lock is never lockinit()d β€” lockuninit() called instead during SYSINIT

Summary

backlight_drvinit() calls lockuninit(&backlight_lock) (line 147) -- teardown routine (kern_lock.c:1324 De-initialize a lock) -- instead of lockinit(&backlight_lock wmesg timo flags) which sets lk_wmesg. Lock declared static struct lock (BSS-zeroed lk_wmesg stays NULL). lockmgr uses lk_wmesg as tsleep message on contention (kern_lock.c:179 251 382 440 699). If lock contended tsleep(...NULL...) invoked. Currently only guards alloc_unr/free_unr/make_dev/destroy_dev in infrequent register/destroy so not observed. No unprivileged trigger register/destroy kernel/root-initiated. Risk malformed lock state under future heavier use or lock debugging assertions. lockinit documented prerequisite kern_lock.c:1296.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2185 Β· 4 files
FileTypeDescriptionSize
VERDICT.md file 742 B ↓ raw
build.sh file 161 B view raw
fix.diff file 171 B view raw
run.sh file 80 B view raw
VERDICT.md file
↓ download raw

DF-2185 - Verification Verdict

Status: reproduced (source-confirmed) Impact: panic Confidence: certain

Verdict

Source-confirmed: backlight_drvinit (:147) calls lockuninit (teardown) instead of lockinit; backlight_lock never properly initialized; used at :113/:121/:135; backlight-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/backlight/backlight.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

fixed
baseline reproduced→ patch + rebuild →patched clean

batch build rc=0

batch build rc=0
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

backlight_drvinit lockuninit not lockinit; backlight-gated

Verified recommended fix

backlight_drvinit lockuninit not lockinit; backlight-gated

Verdict

backlight_drvinit lockuninit not lockinit; backlight-gated