Mask bits properly for pte_prot() in case it is called with additional
authorMatthew Dillon <dillon@dragonflybsd.org>
Wed, 26 May 2004 23:34:25 +0000 (23:34 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Wed, 26 May 2004 23:34:25 +0000 (23:34 +0000)
commit639a9b4387612c5b43f5dd3396a9f10fc6498e72
treef7ebfb0ff93f3ea1ff10672f8db5ce3b807e7aed
parentfbda7fa605557413564473d8e7117d8e615124d3
Mask bits properly for pte_prot() in case it is called with additional
VM_PROT_ bits.

Fix a wired memory leak bug in pmap_enter().  If a page wiring change is
made and the page has already been faulted in for read access, and a
write-fault occurs, pmap_enter() was losing track of the wiring count in
the pmap when it tried to optimize the RO->RW case in the page table.
This prevented the page table page from being freed and led to a memory leak.

The case is easily reproducable if you attempt to wire the data/bss crossover
page in a program (typically just declare a global variable in a small program
and mlock() its page, then exit without munlock()ing).  4K is lost each time
the program is run.
sys/i386/i386/pmap.c
sys/platform/pc32/i386/pmap.c