Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Oct 2019 15:33:47 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352930 - head/sys/arm64/arm64
Message-ID:  <201910011533.x91FXluG064105@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Tue Oct  1 15:33:47 2019
New Revision: 352930
URL: https://svnweb.freebsd.org/changeset/base/352930

Log:
  In short, pmap_enter_quick_locked("user space", ..., VM_PROT_READ) doesn't
  work.  More precisely, it doesn't set ATTR_AP(ATTR_AP_USER) in the page
  table entry, so any attempt to read from the mapped page by user space
  generates a page fault.  This problem has gone unnoticed because the page
  fault handler, vm_fault(), will ultimately call pmap_enter(), which
  replaces the non-working page table entry with one that has
  ATTR_AP(ATTR_AP_USER) set.
  
  This change reduces the number of page faults during a "buildworld" by
  about 19.4%.
  
  Reviewed by:	andrew, markj
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D21841

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

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c	Tue Oct  1 15:10:35 2019	(r352929)
+++ head/sys/arm64/arm64/pmap.c	Tue Oct  1 15:33:47 2019	(r352930)
@@ -3752,8 +3752,8 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v
 	    ATTR_AP(ATTR_AP_RO) | L3_PAGE;
 	if ((prot & VM_PROT_EXECUTE) == 0 || m->md.pv_memattr == DEVICE_MEMORY)
 		l3_val |= ATTR_XN;
-	else if (va < VM_MAXUSER_ADDRESS)
-		l3_val |= ATTR_PXN;
+	if (va < VM_MAXUSER_ADDRESS)
+		l3_val |= ATTR_AP(ATTR_AP_USER) | ATTR_PXN;
 
 	/*
 	 * Now validate mapping with RO protection



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