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

Double-free containment in _kfree_obj is INVARIANTS-only: the compiled-in KMALLOC_CHECK_DOUBLE_FREE bitmap and all ring-sanity checks are no-ops in production kernels, so a double free silently duplicates or drops free-ring pointers

Field Value
ID DF-2820
Status new
Severity Info
CVSS 3.1 CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:L/I:L/A:L
CWE CWE-691 (non-enforced safety check)
File sys/kern/kern_kmalloc.c
Lines 959-967 (KKASSERT-gated checks at :632/:646/:942/:966)
Area kern
Confidence certain
Discovered 2026-08-31
Pass 2 (GLM 5.3 second pass)
Bucket base:kern
Reported pending
Known CVE none
CVE match novel

Summary

sys/_malloc.h:58 compiles KMALLOC_CHECK_DOUBLE_FREE in by default "for safety", but every enforcement point is a KKASSERT (compiled out without INVARIANTS). In production builds: (a) the common double-free case (destination ring slot empty) is fully SILENT β€” the duplicate pointer is stored, putting the same kernel address into the free ring twice so two subsequent kmalloc_obj callers receive the same object (cross-subsystem aliasing β†’ UAF-class corruption); (b) when the destination slot is occupied, the code prints and then unconditionally overwrites the slot anyway, silently dropping a live free-object pointer. The guard exists precisely to catch caller bugs β€” and catches them only on INVARIANTS/debug kernels. Amplifier only (requires a pre-existing kernel double-free; none known in-tree).

Make detection unconditional and fail-safe: on finding the bit already clear (or the slot occupied), do NOT store into the ring β€” panic unconditionally or refuse the free + rate-limited kprintf (row diff).

Timeline

  • 2026-08-31 Discovered during pass-2 audit of kern_kmalloc.c (GLM 5.3).

Discussion (0)

No comments yet.