⬢ DragonFlyBSD Kernel Audit
DF-4533 / verdict.json
← back to finding ↓ download raw
{
  "finding_id": "DF-4533",
  "status": "inconclusive",
  "reproduced": 0,
  "impact": "none",
  "confidence": "certain",
  "verdict": "REAL BUG, runtime-gated on absent hardware. drm_open() takes a minor reference at drm_file.c:325 (drm_minor_acquire -> drm_dev_get) and, mirroring Linux, keeps it on SUCCESS - the open file owns it and Linuxs drm_release() drops it via file_priv->minor. On DragonFly the live release path is drm_close(), which releases ONLY its own fresh acquire (drm_file.c:373 acquire / :445 release); the open-held reference is never dropped anywhere: drm_release() is dead on DragonFly (returns at :604) and drm_cdevpriv_dtor() (drm_drv.c:1194) is never registered (no devfs_set_cdevpriv caller - mechanically proven). Net +1 drm_device kref per open/close cycle: dev->ref never returns to base, drm_dev_release()/drm_dev_fini() (drm_drv.c:737/666) can never run, so the whole drm_device leaks at driver unload, and the unbounded int atomic counter can in principle be wrapped by ~2^31 cycles (trigger.c). Low severity (bounded leak, no memory-safety consequence); extends the DF-1678 open/release vs unload minor refcount protocol family as requested by pass 2.",
  "exploit_chain": "",
  "evidence": "static_proof.log (PASS); VERDICT.md (full acquire/release ledger); fix.diff (applies clean); fix_build.log (patched drm_file.c compiles RC=0 with exact kernel CFLAGS); run evidence in DF-4531/run.log (hardware-gated trigger output on the shared guest)",
  "kernel_refs": [
    "sys/dev/drm/drm_file.c:325",
    "sys/dev/drm/drm_file.c:357",
    "sys/dev/drm/drm_file.c:373",
    "sys/dev/drm/drm_file.c:445",
    "sys/dev/drm/drm_file.c:595",
    "sys/dev/drm/drm_drv.c:737",
    "sys/dev/drm/drm_drv.c:271"
  ],
  "poc_changes": "Wrote from scratch: trigger.c (open/close cycle driver) and static_proof.sh (tree-level proof of the imbalance).",
  "attempts": 1,
  "guest_uname": "DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul  2 06:02:54 UTC 2026     root@dfbsd:/usr/obj/usr/src/sys/X86_64_GENERIC  x86_64",
  "runtime_sec": 45,
  "guest_dirty": 0,
  "build_cmd": "cc -Wall -Wextra -O2 -o trigger trigger.c",
  "run_cmd": "./trigger 100000",
  "code_hash": "fb3c8e285654cdca6854a063f1c42b4eacc333457baac208c070fe6bc2d4b1d4",
  "notes": "Runs on the guest were hardware-gated (/dev/dri absent, no drm driver attaches to QEMU std VGA). Distinct from DF-1678 (ERR_PTR deref panic in the same drm_close prologue) and DF-1679 (open_count lock contract): this is the leaked-DEV-reference side of the same broken port of the Linux open/release refcount protocol. Same-anchor note: DF-4532s fix.diff anchors at drm_close()s tail too - merge manually if both applied.",
  "recommended_fix": "In drm_close(), save file_priv->minor before kfree(file_priv) and drm_minor_release() it at the tail (balancing drm_opens success-path acquire) - see fix.diff.",
  "fix_status": "not_testable",
  "fix_baseline_reproduced": 0,
  "fix_patched_reproduced": 0,
  "fix_verdict": "Patch compiles clean (RC=0) with exact X86_64_GENERIC kernel CFLAGS on the guest; applies cleanly to the pristine tree. Runtime validation needs a DRM device (absent here); the fix restores the Linux acquire/release pairing by construction while keeping the DF-1678-era close-time safety acquire.",
  "fix_evidence": "findings/poc/DF-4533/fix.diff; findings/poc/DF-4533/fix_build.log"
}