Linuxkpi Dmamap
FreeBSD LinuxKPI: invalid DMA map during i915 GEM teardown
Submission draft; not submitted. Local investigation ID: BUG-1. The panic is confirmed; a DMA-map use-after-destroy is a hypothesis, not yet a confirmed root cause. Complete the missing-information checklist before filing where possible; explicitly mark anything unavailable.
Suggested Bugzilla fields
| Field | Suggested value |
|---|---|
| Product | Base System (suspected code is in the FreeBSD kernel) |
| Component | kern |
| Version | 15.1-RELEASE if offered; otherwise the closest applicable 15.1 entry, with the exact build below in Description |
| Hardware | amd64, or PC if the form uses platform names; include amd64 in Description |
| OS | Any if the form offers no FreeBSD choice; exact OS belongs in Description |
| Summary | LinuxKPI: page fault in bounce_bus_dmamap_sync during i915 GEM teardown (map=0xffffffffffffffff) |
| Severity | Affects Many People if appropriate to the available choices for a kernel crash; only one machine is confirmed affected |
| Priority / assignee / status / keywords | Leave defaults; let triage assign ownership and priority |
| Description | Copy the report below, filling missing details |
| Attachment | panic-evidence.2.txt, text/plain, not a patch |
Field names and available choices may vary. The live form was blocked by its anti-bot page during preparation, so mandatory dropdown choices could not be verified. Follow any required-field markers in the form; do not guess a driver package version or claim broad reproduction. A Ports & Packages report for the specific drm port can be linked later if triage identifies the driver as owner.
Report to paste into Description
Problem
The kernel panicked during i915 GEM buffer-object teardown. In vmcore.2,
linux_dma_unmap_sg_attrs() called bus_dmamap_sync() with
map=0xffffffffffffffff, faulting in bounce_bus_dmamap_sync().
Expected: teardown of a successfully mapped GEM object completes without a panic;
failed mappings are unwound without later use of invalid mapping state.
Actual: kernel page fault at virtual address 0xffffffffffffffff.
Environment
| Item | Value |
|---|---|
| OS / architecture | FreeBSD 15.1-RELEASE-p3 / amd64 |
| Kernel | #8 releng/15.1-88e7371d9dc2-dirty, GENERIC-DEBUG |
| Build time | Fri Oct 2 21:21:03 UTC 2026 |
| Crash report date | Sat Oct 3 04:24:30 UTC 2026 |
| Uptime at panic | 4h42m25s |
| CPU / GPU | Intel N95 (Alder Lake-N), UHD Graphics, PCI 0:2:0, device 0x46d2 (hardware details from investigation notes) |
| Modules | i915kms.ko, drm.ko, LinuxKPI; exact drm package/source revision still needed |
| Local modifications | Dirty kernel and diagnostic DRM build; exact patches and build configuration still needed |
The crash report loaded symbols from /boot/kernel.zfsdiag/kernel and
/boot/modules/i915kms.ko, with separate debug files. This was not an unmodified
stock-kernel reproduction. Results on a stock supported kernel/driver combination
are not yet recorded.
Reproduction
No minimal reproducer or reliable sequence is recorded in the available notes.
The observed failure occurred in the i915 kernel worker while freeing GEM
objects. Workload, frequency, render-node permissions, memory pressure, and any
last-known-good version remain to be supplied. Do not treat the other dumps
listed below as repeated reproductions of this exact fault.
Confirmed evidence
The attached panic-evidence.2.txt contains selected text from core.txt.2,
including kernel identification, the trap registers, and symbolized frames:
panic: page fault
fault virtual address = 0xffffffffffffffff
current process = 0 (i915)
rdi: fffff8000bb4a000 rsi: ffffffffffffffff rdx: 0000000000000002
bounce_bus_dmamap_sync(dmat=0xfffff8000bb4a000, map=0xffffffffffffffff, op=2)
bus_dmamap_sync(dmat=0xfffff8000bb4a000, map=0xffffffffffffffff, op=2)
linux_dma_unmap_sg_attrs(sgl=0xfffffe0156e4e000,
direction=DMA_BIDIRECTIONAL, attrs=0) at linux_pci.c:1973
i915_gem_gtt_finish_pages at i915_gem_gtt.c:67
i915_gem_object_put_pages_shmem at i915_gem_shmem.c:660
__i915_gem_object_put_pages
__i915_gem_object_pages_fini
__i915_gem_free_objects
linux_work_fn
taskqueue_run_locked
taskqueue_thread_loop
Suspected cause and limits of the evidence
In the local /usr/src/sys/compat/linuxkpi/common/src/linux_pci.c,
linux_dma_map_sg_attrs() stores a map in sgl->dma_map. If
_bus_dmamap_load_phys() fails, it unloads and destroys the map, returns zero,
and leaves that field unchanged. linux_dma_unmap_sg_attrs() subsequently uses
the field without checking mapping state. Successful unmap also leaves it set.
These are source observations; the exact crash-build source diff is needed to
establish provenance.
This suggests investigating stale mapping state, repeated teardown, or a scatterlist lifetime/corruption issue. The dump does not establish that a map load failed earlier, that this scatterlist was subsequently unmapped after that failure, or that the all-ones value was a freed map handle. The error path alone does not prove the cause of this panic.
Both Linux and this LinuxKPI implementation return a positive mapped-entry count
on successful dma_map_sg() and zero on failure. The local
i915_gem_gtt_prepare_pages() treats a nonzero return as success and retries or
returns -ENOSPC on failure. There is no demonstrated inverted-return check.
See the Linux DMA API contract.
An unconditional unmap after a failed map is not established by the inspected
caller and must not be assumed.
Possible fix direction, pending lifetime analysis: ensure mapping ownership is tracked consistently across failure, retry and teardown. Clearing a field and adding a NULL guard alone does not validate an all-ones pointer or prevent a race; check whether NULL is a valid map representation for the relevant bus_dma backend before adopting it as a sentinel. No fix has been validated.
Impact and related observations
Confirmed impact is a kernel panic. Unprivileged reachability, reliable triggering, and exploitability have not been demonstrated; a render-node path alone is not proof of any of those claims. No verified workaround is recorded.
Local related evidence, not initially attached:
| Dump | Observation | Relationship |
|---|---|---|
| vmcore.9 | NULL dereference at 0x20 in shmem_sg_free_table |
Unproven |
| vmcore.0 | Diagnostic shmem_after_alloc invalid-chain check, nents=1536 |
Unproven |
| vmcore.4 | Diagnostic after_cond_resched invalid transition, nents=4, orig_nents=2560 |
Unproven |
| vmcore.6 | Diagnostic shmem_before_trim invalid chain, nents=1, orig_nents=2560 |
Unproven |
The latter three are failures detected by locally added DRMDIAG-SG-* checks.
Earlier notes record lkpi_sg_lifetime.lost = 0 for vmcore.2, but the debugger
transcript is not included here. Even if verified, that only addresses the
tracker's dropped-record counter; it does not prove the suspected root cause.
Missing information to collect
- Actual workload and steps before the panic; frequency, affected machines, last-known-good version, and any workaround. State explicitly if unknown.
- Exact drm package names/versions (
pkg info -x 'drm|gpu-firmware'), source commit for locally built DRM, and local patches. Current installed packages may differ from the crash-time versions; label them accordingly. - Crash-build kernel config, source commit and local diff; include diagnostic modifications to kernel and DRM. Do not substitute today's source diff for a historical build without saying so.
- Relevant GPU boot messages, module list, PCI identification, and loader/sysctl
overrides. Useful commands on the affected FreeBSD host:
uname -a,freebsd-version -kru,kldstat -v,pciconf -lv, anddmesg -a. Current outputs are environment context, not historical dump evidence. - Whether it happens on an unmodified supported kernel with a matching DRM package. If untested, say so; a report need not pretend to have this result.
Evidence without uploading a core dump
Initially attach only panic-evidence.2.txt and, when available, the relevant
source/config diffs and a short environment text file. The extracted attachment
has host/build identity redactions and retains addresses needed for debugging.
Review every attachment manually before posting. Full core.txt.2 contains much
more machine state, including networking/process information; do not upload it
unreviewed. Do not attach vmcore.*, compressed cores, or a directory archive
containing the symlinks here.
Retain the matching kernel, debug symbols, DRM modules, sources and dump privately.
If maintainers need more evidence, extract targeted text locally using the exact
crash kernel and module symbols, not whatever /boot/kernel/kernel now contains:
# Decompress vmcore.2.zst locally first if kgdb cannot read it directly.
kgdb -q /path/to/matching/kernel /path/to/uncompressed/vmcore.2
(kgdb) set pagination off
(kgdb) bt
(kgdb) frame <linux_dma_unmap_sg_attrs frame number from bt>
(kgdb) info args
(kgdb) info locals
(kgdb) p *sgl
(kgdb) p/x sgl->dma_map
(kgdb) disassemble /r linux_dma_unmap_sg_attrs
For the supplied report this is frame 10, but use the frame number from the new session. Capture the output as text, including errors or optimized-out values. If symbols do not resolve, fix their provenance before interpreting output. Only inspect pointed-to structures when the addresses are valid; do not call kernel functions from the debugger. Ask for a private transfer arrangement if a maintainer ultimately requires the dump: a kernel dump can contain sensitive memory and is unnecessary for the initial submission.
How to submit
- Search FreeBSD Bugzilla for
linux_dma_unmap_sg_attrs,bounce_bus_dmamap_sync, and i915 teardown panics. Read likely matches; add evidence to an existing matching report when appropriate. This preparation did not establish whether a duplicate exists. - Sign in or create an account, then open a Base System report.
- Use the field table above and paste the report section. Fill missing facts or mark them unknown. Keep suspected causes explicitly tentative.
- Add the reviewed text attachment as
text/plain; do not mark it as a patch. Attach any actual source patch separately and mark that attachment as a patch. - Preview the report and attachments, then submit. Save the PR number/link and answer maintainer questions with targeted text from the retained dump.
Submission guidance: FreeBSD bug reporting entry point and Writing FreeBSD Problem Reports.