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

vunmap() unconditional SLIST_REMOVE/kfree on addr-not-found dereferences NULL and panics

Summary

vunmap() searches vmap_list for addr on match does pmap_qremove/kmem_free then goto found. found: label at line 87 is ALSO fall-through target when SLIST_FOREACH_MUTABLE loop (77-85) exhausts without finding addr -- vmp is NULL (loop terminates var==NULL per queue.h:177-180). Execution then unconditionally reaches SLIST_REMOVE(&vmap_list NULL vmap vm_vmaps) (line 89) which dereferences NULL inside SLIST_REMOVE macro (queue.h:208-220) and panics. Calling vunmap() on any address not currently in vmap_list (double-vunmap error path or TOCTOU with concurrent vunmap) is guaranteed deterministic kernel panic. Reachable: local user with DRM device access DRM ioctls cause i915 to call vunmap(). i915 guards with is_vmalloc_addr(ptr) but is_vmalloc_addr takes no lock reads same shared list concurrent vmap/vunmap can remove entries between check and call making vunmap fail to find ptr hit NULL-deref.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2187 Β· 2 files
FileTypeDescriptionSize
VERDICT.md file 746 B ↓ raw
fix.diff file 164 B view raw
VERDICT.md file
↓ download raw

DF-2187 - Verification Verdict

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

Verdict

Source-confirmed: vunmap (:87-91) found: label is fall-through target when SLIST_FOREACH exhausts; vmp is NULL; SLIST_REMOVE(:89) derefs NULL inside QMD_SAVELINK macro; DRM-module-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/drm/linux_vmalloc.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)

vunmap SLIST_REMOVE NULL vmp; DRM-gated

Verified recommended fix

vunmap SLIST_REMOVE NULL vmp; DRM-gated

Verdict

vunmap SLIST_REMOVE NULL vmp; DRM-gated