svn commit: r316679 - head/sys/arm64/arm64

Konstantin Belousov kib at FreeBSD.org
Mon Apr 10 15:32:27 UTC 2017


Author: kib
Date: Mon Apr 10 15:32:26 2017
New Revision: 316679
URL: https://svnweb.freebsd.org/changeset/base/316679

Log:
  Do not lose dirty bits for removing PROT_WRITE on arm64.
  
  Arm64 pmap interprets accessed writable ptes as modified, since
  ARMv8.0 does not track Dirty Bit Modifier in hardware. If writable bit
  is removed, page must be marked as dirty for MI VM.
  
  This change is most important for COW, where fork caused losing
  content of the dirty pages which were not yet scanned by pagedaemon.
  
  Reviewed by:	alc, andrew
  Reported and tested by:	Mark Millard <markmi at dsl-only.net>
  PR:	217138, 217239
  Sponsored by:	The FreeBSD Foundation
  MFC after:	2 weeks

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

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c	Mon Apr 10 12:35:58 2017	(r316678)
+++ head/sys/arm64/arm64/pmap.c	Mon Apr 10 15:32:26 2017	(r316679)
@@ -2481,6 +2481,11 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
 		    sva += L3_SIZE) {
 			l3 = pmap_load(l3p);
 			if (pmap_l3_valid(l3)) {
+				if ((l3 & ATTR_SW_MANAGED) &&
+				    pmap_page_dirty(l3)) {
+					vm_page_dirty(PHYS_TO_VM_PAGE(l3 &
+					    ~ATTR_MASK));
+				}
 				pmap_set(l3p, ATTR_AP(ATTR_AP_RO));
 				PTE_SYNC(l3p);
 				/* XXX: Use pmap_invalidate_range */


More information about the svn-src-all mailing list