Avoid erroneously clearing PGA_WRITEABLE in riscv's pmap_enter().

During a CoW fault, we must check for both 4KB and 2MB mappings before
clearing PGA_WRITEABLE on the old mapping's page.  Previously we were
only checking for 4KB mappings.  This was missed in r344106.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
markj 2019-10-08 15:03:48 +00:00
parent 236e505a95
commit 1e2840f2f0

View File

@ -2833,7 +2833,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
if ((new_l3 & PTE_SW_MANAGED) == 0)
free_pv_entry(pmap, pv);
if ((om->aflags & PGA_WRITEABLE) != 0 &&
TAILQ_EMPTY(&om->md.pv_list))
TAILQ_EMPTY(&om->md.pv_list) &&
((om->flags & PG_FICTITIOUS) != 0 ||
TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list)))
vm_page_aflag_clear(om, PGA_WRITEABLE);
}
pmap_invalidate_page(pmap, va);