Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Sep 2014 18:49:57 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r271716 - in head/sys: amd64/amd64 i386/i386
Message-ID:  <201409171849.s8HInv5S007289@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Sep 17 18:49:57 2014
New Revision: 271716
URL: http://svnweb.freebsd.org/changeset/base/271716

Log:
  Presence of any VM_PROT bits in the permission argument on x86 implies
  that the entry is readable and valid.
  
  Reported by:	markj
  Submitted by:	alc
  Tested by:	pho (previous version), markj
  MFC after:	3 days

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	Wed Sep 17 18:46:51 2014	(r271715)
+++ head/sys/amd64/amd64/pmap.c	Wed Sep 17 18:49:57 2014	(r271716)
@@ -3845,7 +3845,8 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
 	pt_entry_t *pte, PG_G, PG_M, PG_RW, PG_V;
 	boolean_t anychanged, pv_lists_locked;
 
-	if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
+	KASSERT((prot & ~VM_PROT_ALL) == 0, ("invalid prot %x", prot));
+	if (prot == VM_PROT_NONE) {
 		pmap_remove(pmap, sva, eva);
 		return;
 	}

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Wed Sep 17 18:46:51 2014	(r271715)
+++ head/sys/i386/i386/pmap.c	Wed Sep 17 18:49:57 2014	(r271716)
@@ -3161,7 +3161,8 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
 	pt_entry_t *pte;
 	boolean_t anychanged, pv_lists_locked;
 
-	if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
+	KASSERT((prot & ~VM_PROT_ALL) == 0, ("invalid prot %x", prot));
+	if (prot == VM_PROT_NONE) {
 		pmap_remove(pmap, sva, eva);
 		return;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409171849.s8HInv5S007289>