Author: markj
Date: Tue Oct  8 15:03:48 2019
New Revision: 353308
URL: https://svnweb.freebsd.org/changeset/base/353308

Log:
  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

Modified:
  head/sys/riscv/riscv/pmap.c

Modified: head/sys/riscv/riscv/pmap.c
==============================================================================
--- head/sys/riscv/riscv/pmap.c Tue Oct  8 14:59:50 2019        (r353307)
+++ head/sys/riscv/riscv/pmap.c Tue Oct  8 15:03:48 2019        (r353308)
@@ -2833,7 +2833,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v
                        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);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to