[DragonFlyBSD - Bug #3430] (Resolved) pc64 pmap: wired-to-wired PTE replacement loses wire references

liweitianux bugtracker-admin at leaf.dragonflybsd.org
Mon Oct 5 04:13:41 PDT 2026


Issue #3430 has been updated by liweitianux.

Status changed from New to Resolved

Patch merged. Thank you.

----------------------------------------
Bug #3430: pc64 pmap: wired-to-wired PTE replacement loses wire references
http://bugs.dragonflybsd.org/issues/3430#change-14782

* Author: sigttou
* Status: Resolved
* Priority: Normal
* Category: Kernel
* Target version: 6.6
* Start date: 2026-10-03
----------------------------------------
pmap_enter() only adds the new wired reference when the old PTE was not wired,
but it always drops the old wired reference. Replacing a wired mapping with
another wired mapping therefore loses a pmap wire count and a vm_page wire count.

This shows up as a panic ("vm_page_unwire: invalid wire count: 0") after an
mlock()ed mapping has its protection changed to read-only and back, and as a
negative wired count ("fatal pmap problem ... wirecnt=-6") when a vkernel exits.

Fix: count the new wired reference whenever the new PTE is wired, matching the
unconditional drop of the old one. For an already-wired same-page replacement,
which may be soft-busied, use vm_page_wire_quick() instead of vm_page_wire().
Skip fictitious pages, which have no physical wire count.

---Files--------------------------------
0001-pmap-wired-replacement.patch (1.36 KB)
0001-pmap-wired-replacement-v3.patch (2.55 KB)
0001-pmap-wired-replacement-v4.patch (2.56 KB)


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account


More information about the Bugs mailing list