svn commit: r339490 - in head/sys: amd64/amd64 i386/i386

Mark Johnston markj at FreeBSD.org
Sat Oct 20 20:53:36 UTC 2018


Author: markj
Date: Sat Oct 20 20:53:35 2018
New Revision: 339490
URL: https://svnweb.freebsd.org/changeset/base/339490

Log:
  Add an assertion to pmap_enter().
  
  When modifying an existing managed mapping, we should find a PV entry
  for the old mapping.  Verify this.
  
  Before r335784 this would have been implicitly tested by the fact that
  we always freed the PV entry for the old mapping.
  
  Reviewed by:	alc, kib
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D17626

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Sat Oct 20 20:51:05 2018	(r339489)
+++ head/sys/amd64/amd64/pmap.c	Sat Oct 20 20:53:35 2018	(r339490)
@@ -5141,6 +5141,8 @@ retry:
 				vm_page_aflag_set(om, PGA_REFERENCED);
 			CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, opa);
 			pv = pmap_pvh_remove(&om->md, pmap, va);
+			KASSERT(pv != NULL,
+			    ("pmap_enter: no PV entry for %#lx", va));
 			if ((newpte & PG_MANAGED) == 0)
 				free_pv_entry(pmap, pv);
 			if ((om->aflags & PGA_WRITEABLE) != 0 &&

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Sat Oct 20 20:51:05 2018	(r339489)
+++ head/sys/i386/i386/pmap.c	Sat Oct 20 20:53:35 2018	(r339490)
@@ -3820,6 +3820,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, v
 			if ((origpte & PG_A) != 0)
 				vm_page_aflag_set(om, PGA_REFERENCED);
 			pv = pmap_pvh_remove(&om->md, pmap, va);
+			KASSERT(pv != NULL,
+			    ("pmap_enter: no PV entry for %#x", va));
 			if ((newpte & PG_MANAGED) == 0)
 				free_pv_entry(pmap, pv);
 			if ((om->aflags & PGA_WRITEABLE) != 0 &&


More information about the svn-src-head mailing list