Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Nov 2011 00:12:16 +0000 (UTC)
From:      Olivier Houchard <cognet@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r227288 - projects/armv6/sys/arm/arm
Message-ID:  <201111070012.pA70CGSr048446@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cognet
Date: Mon Nov  7 00:12:16 2011
New Revision: 227288
URL: http://svn.freebsd.org/changeset/base/227288

Log:
  - Ooops, we should check PGA_WRITEABLE agains aflags, not flags.
  - in pmap_fault_fixup(), don't assume the mapping as to be a user mapping
  only because the fault comes from userland. If we were faulting from
  copyin/copyout or friends, we would remove the userland access, and bad
  thing would happen.

Modified:
  projects/armv6/sys/arm/arm/pmap-v6.c

Modified: projects/armv6/sys/arm/arm/pmap-v6.c
==============================================================================
--- projects/armv6/sys/arm/arm/pmap-v6.c	Sun Nov  6 23:34:40 2011	(r227287)
+++ projects/armv6/sys/arm/arm/pmap-v6.c	Mon Nov  7 00:12:16 2011	(r227288)
@@ -890,6 +890,7 @@ pmap_clearbit(struct vm_page *pg, u_int 
 		if (npte != opte) {
 			count++;
 			*ptep = npte;
+			PTE_SYNC(ptep);
 			/* Flush the TLB entry if a current pmap. */
 			if (PV_BEEN_EXECD(oflags))
 				cpu_tlb_flushID_SE(pv->pv_va);
@@ -1261,7 +1262,7 @@ pmap_fault_fixup(pmap_t pm, vm_offset_t 
 
 		/* Re-enable write permissions for the page */
 		*ptep = (pte & ~L2_TYPE_MASK) | L2_S_PROTO;
-		pmap_set_prot(ptep, VM_PROT_WRITE, user);
+		pmap_set_prot(ptep, VM_PROT_WRITE, *ptep & L2_S_PROT_U);
 		CTR1(KTR_PMAP, "pmap_fault_fix: new pte:0x%x", pte);
 		PTE_SYNC(ptep);
 		rv = 1;
@@ -3391,7 +3392,7 @@ pmap_clear_modify(vm_page_t m)
 	 * If the object containing the page is locked and the page is not
 	 * VPO_BUSY, then PGA_WRITEABLE cannot be concurrently set.
 	 */
-	if ((m->flags & PGA_WRITEABLE) == 0)
+	if ((m->aflags & PGA_WRITEABLE) == 0)
 		return;
 
 	if (m->md.pvh_attrs & PVF_MOD)
@@ -3431,7 +3432,7 @@ pmap_remove_write(vm_page_t m)
 	 */
 	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
 	if ((m->oflags & VPO_BUSY) != 0 ||
-	    (m->flags & PGA_WRITEABLE) != 0)
+	    (m->aflags & PGA_WRITEABLE) != 0)
 		pmap_clearbit(m, PVF_WRITE);
 }
 



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