$ uname -a A_BLOG_ABOUT_UNIX_TOOLS_AND_THE_BEAUTY_OF_SIMPLE_SYSTEMS
SYS.YEAR  2026
← Back to articles
2026-12-02ARTICLE

Drm Commit Uaf

drm-commit-uaf — upstream submission draft

Local tracking ID: BUG-2. Nothing has been submitted. The report body below can be pasted into an issue; the remaining sections are preparation instructions. Unknown items are explicit so that observations are not mistaken for a proven fix.

Suggested issue title

i915: invalid drm_crtc_commit refcount during plane-state cleanup (FreeBSD 15.1, Intel N95)

Report body

Summary and impact

A locally instrumented FreeBSD DRM build panicked when drm_crtc_commit_put() encountered refcount=0xdeadc0de during asynchronous atomic state cleanup. The observed result is a system panic. This suggests a commit lifetime error / use-after-free, but the first invalid lifetime transition and the underlying cause have not been identified. There is no fix yet.

Environment

Item Recorded value
OS / architecture FreeBSD 15.1-RELEASE-p3 / amd64
Kernel #8 releng/15.1-88e7371d9dc2-dirty, GENERIC-DEBUG
Kernel build Fri Oct 2 21:21:03 UTC 2026
Crash summary timestamp Fri Oct 2 23:39:45 UTC 2026
Uptime at panic 1h50m7s
CPU / GPU Intel N95 (Alder Lake-N), UHD Graphics, PCI 0:2:0, device 0x46d2 (from original investigation notes; attach PCI output to verify)
Loaded DRM modules i915kms.ko, drm.ko, dmabuf.ko, ttm.ko; LinuxKPI support
Build provenance Custom DRM diagnostic tree; custom kernel. Exact DRM revision and complete crash-time patches still to be supplied
Desktop context Hyprland appears in another CPU's trace, exiting after SIGKILL; causal relationship unknown
Stock / newer build comparison Not established in the supplied evidence

The dump summary loaded the kernel from /boot/kernel.zfsdiag/kernel and DRM modules from /boot/modules/, with corresponding debug symbols. These paths do not by themselves prove that the binaries and source trees match.

Reproduction and expected behavior

No deterministic reproducer is available from the supplied files. One diagnostic panic is documented here. Workload, exact actions before the panic, recurrence rate, display topology, and any suspend/resume or hotplug activity remain to be supplied. Hyprland's SIGKILL is context, not a demonstrated reproduction step.

Expected: atomic state cleanup releases valid references without a panic. Actual: DRM flip/commit timeouts precede an invalid-reference diagnostic panic. No verified workaround is available.

Panic and relevant call path

panic: DRMDIAG-REF: invalid drm_crtc_commit reference:
  commit=0xfffff8006946b7c0 op=2 refcount=0xdeadc0de
  caller=0xffffffff8401b05d sequence=35970
cpuid = 3

Read the following path from worker to failing operation:

intel_atomic_cleanup_work
  drm_atomic_state_put -> __drm_atomic_state_free
    drm_atomic_state_clear -> intel_atomic_state_clear
      drm_atomic_state_default_clear
        intel_plane_destroy_state
          __drm_atomic_helper_plane_destroy_state
            drm_crtc_commit_put
              drmdiag_commit_record -> drmdiag_commit_record_impl -> panic

The existing symbolized trace resolves 0xffffffff8401b05d to intel_plane_destroy_state() at drivers/gpu/drm/i915/display/intel_atomic_plane.c:138. The put is inlined into __drm_atomic_helper_plane_destroy_state() at drivers/gpu/drm/drm_atomic_state_helper.c:410. These line numbers belong to the local diagnostic build. The plane state is 0xfffff800197af600; the atomic state is 0xfffff8044f7fe000.

Immediately preceding console messages include:

drmn0: [drm] *ERROR* flip_done timed out
drmn0: [drm] *ERROR* [CRTC:80:pipe A] commit wait timed out
drmn0: [drm] *ERROR* flip_done timed out
drmn0: [drm] *ERROR* [PLANE:31:plane 1A] commit wait timed out

Local instrumentation and interpretation

The panic comes from a locally added guard, not an upstream assertion. The original notes identify op=2 as DRMDIAG_COMMIT_PUT and give this guard:

/* Local diagnostic drm_atomic.c:121-125; full crash-time patch needed. */
if ((op == DRMDIAG_COMMIT_GET || op == DRMDIAG_COMMIT_PUT) &&
    unlikely(refcount == 0 || (refcount & 0x80000000U) != 0))
        panic("DRMDIAG-REF: invalid drm_crtc_commit reference: "
            "commit=%p op=%u refcount=%#x caller=%p sequence=%lu",
            commit, op, refcount, caller, sequence);

0xdeadc0de is consistent with free-poison according to the investigation notes; its high bit triggers this guard. The attached summary confirms the recorded value and cleanup path, but does not independently establish how that value was written. Double put, a missing get, a stale/corrupted pointer, or another memory corruption remain possibilities. The diagnostic changes also need review. sequence=35970 is a diagnostic counter, not a timestamp; uptime comes from the console output.

The observed put site is known. The earlier allocation/get/put/free history is not. No claim of render-node-only reachability, exploitability, or a specific faulty get/put pair is established by this evidence. Please advise what targeted lifetime logging or testing would best distinguish these possibilities.

Attached evidence

drm-commit-uaf-evidence.txt contains the symbolized panic-thread backtrace (including available locals), the preceding DRM timeouts, console trace, and uptime extracted from core.txt.1. Source prefixes are shortened; addresses and unwind errors are preserved. The final kgdb unwind beyond the worker thread is unreliable and is not used to infer another bug.

A full vmcore is retained locally and is not attached. Targeted debugger output can be supplied on request using the matching kernel/module binaries and symbols.

Information to gather before filing

Supply what is known; explicitly leave unavailable historical details as unknown. Do not label a current checkout or current package version as the crash-time build. The most important missing items are the DRM revision and complete diagnostic patches, followed by the workload / reproduction history.

  • Exact DRM branch, commit, port origin and package version (if packaged); firmware versions; whether modules were built against the running kernel sources.
  • Crash-time kernel and DRM diffs, including all diagnostic hooks, enum definitions, refcount reads, poison/free changes, and any other experimental changes. The short guard above is insufficient to reproduce or review the diagnostic build.
  • Kernel configuration and relevant build/loader/sysctl options, including INVARIANTS, WITNESS, allocator diagnostics, and LinuxKPI changes.
  • GPU PCI identity; display connectors, monitor count/resolution/refresh; compositor version; recent modesets, compositor restart/kill, hotplug, suspend or resume.
  • What was running and what the user did immediately before the crash, frequency, first affected / last known good versions, and tests with stock or newer matched kernel/DRM builds. Say “not tested” where applicable; comparisons are useful but a deterministic reproducer is not a prerequisite for reporting this panic.

On the affected FreeBSD host, these read-only commands help collect current metadata. Save and label their output with the collection date; they do not recover historical build state:

freebsd-version -kru
uname -a
pkg info -x 'drm|gpu-firmware|hyprland'
kldstat
pciconf -lv vgapci0
sysctl kern.conftxt

For the source trees used to build the crashing binaries (substitute their paths):

git -C /path/to/drm-kmod rev-parse HEAD
git -C /path/to/drm-kmod status --short
git -C /path/to/drm-kmod diff HEAD --
git -C /usr/src rev-parse HEAD
git -C /usr/src status --short
git -C /usr/src diff HEAD --

git diff HEAD omits untracked files; include any untracked diagnostic sources that participated in the build. Preserve matching kernel/modules/debug files locally before upgrading. A current dirty tree may differ from the crash build.

Evidence without a whole core dump

Start with these small, reviewed text attachments:

Attachment Purpose / status
drm-commit-uaf-evidence.txt Prepared: selected crash evidence, about a few KB
build-info.txt To collect: revisions, module/package versions, PCI identity, relevant kernel configuration and workload details
diagnostic-changes.patch To collect: complete changes relative to the identified crash-time source baseline; mark explicitly as diagnostic, not a proposed fix
drm-log.txt To collect if available: boot DRM initialization/firmware messages and relevant log context before the panic; identify whether from the crash boot or a later boot

Review all attachments manually. The full core.txt.1 includes unrelated process traces and system details, so use the prepared excerpt initially. Remove personal hostnames, usernames, network addresses, serial numbers and private paths where irrelevant. Keep function names, revisions, error text, and consistent object addresses needed to correlate this failure. Do not post credentials or application memory. A compressed vmcore still contains memory; compression is not redaction.

If maintainers need more, run targeted commands locally in kgdb with the exact crash binaries/symbols and an uncompressed local copy of vmcore.1:

kgdb /path/to/matching/kernel /path/to/local/vmcore.1
(kgdb) bt full
(kgdb) info line *0xffffffff8401b05d
(kgdb) p *(struct drm_crtc_commit *)0xfffff8006946b7c0
(kgdb) p *(struct drm_plane_state *)0xfffff800197af600

Check that kgdb loaded the matching drm.ko and i915kms.ko debug symbols before interpreting these results. The supplied summary already provides the backtrace and caller resolution; rerunning those is optional. Object fields may be stale, poisoned or reused. Review each output before attaching it. If crash-time lifetime records exist, extract just records for this commit and its owning state, preserving event order and get/put/free sites. Do not infer earlier events from the final refcount alone. A maintainer can request further text output without receiving the dump. Discuss any eventual private dump transfer separately before sharing it.

Where and how to submit

Recommended first destination: the FreeBSD drm-kmod issue tracker. This is a FreeBSD port of Linux DRM, as described in its README; a Linux upstream defect has not been demonstrated. Start with the FreeBSD maintainers, who can route a shared DRM issue further if warranted.

  1. Search the tracker for drm_crtc_commit, plane_destroy_state, flip_done, and similar Intel cleanup panics. If the same failure exists, add the evidence there and explain how the builds/hardware compare.
  2. Sign in and choose New issue. Follow any template presented. The live authenticated form/template was not accessible during preparation, so its current mandatory UI fields have not been verified.
  3. Use the suggested title and paste only the Report body sections above. Fill the missing build and workload details where possible. GitHub needs a title and description; the technical checklist above is what makes this particular report actionable. Labels and assignees can be left to maintainers.
  4. Attach the reviewed text evidence and available build/diagnostic files. Preview formatting and verify that no vmcore or unrelated logs are attached.
  5. Submit, save the issue URL, and answer follow-up questions with targeted evidence. Report later test results with exact revisions and whether the panic recurred.

FreeBSD Bugzilla alternative

Use FreeBSD's bug submission entry point if maintainers prefer a FreeBSD PR or if tracking the packaged port is appropriate. Avoid two independent reports; cross-link them if both are requested. The official problem-report guide explains the fields and evidence expected. The logged-in form was not inspected; follow its current required fields. Suggested values are:

Field Suggested entry
Account / contact A working email address for follow-up; account email may be public
Product Ports & Packages for the external drm-kmod port; use Base System / kern only if the issue is identified in base kernel/LinuxKPI code
Component For the port, Individual Port(s) if offered; verify the current form
Summary Prefix the suggested title with the actual graphics/<installed-drm-port> origin, once identified; do not guess the DRM version
Version Select the affected version appropriate to the chosen product; put exact OS and DRM revisions in the description regardless
Hardware / OS, if requested amd64 / FreeBSD; include Intel GPU details in the description
Severity Affects Only Me (or the form's equivalent) until other affected systems are known; explain that the symptom is a kernel panic
Description / environment / reproduction The report body, completed build details, expected/actual behavior, and honest reproduction status
Attachments Reviewed text evidence and diagnostic patch; mark a patch attachment as a patch, with its diagnostic purpose clearly stated
Assignee / priority / optional flags Leave defaults unless maintainers direct otherwise

The guide recommends exact versions, reproduction details, kernel configuration, panic/backtrace text and relevant PCI/log excerpts. Those can be supplied as text; a full core dump is not part of this initial evidence bundle.