Module Name:    src
Committed By:   maxv
Date:           Wed Mar 15 16:42:18 UTC 2017

Modified Files:
        src/sys/arch/x86/x86: pmap.c

Log Message:
Add a comment to answer a question regarding privilege separation when
modifying a PTE from an active page tree. The question is from Manuel
Bouyer, and the answer is from me.


To generate a diff of this commit:
cvs rdiff -u -r1.242 -r1.243 src/sys/arch/x86/x86/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.242 src/sys/arch/x86/x86/pmap.c:1.243
--- src/sys/arch/x86/x86/pmap.c:1.242	Thu Mar  9 00:21:55 2017
+++ src/sys/arch/x86/x86/pmap.c	Wed Mar 15 16:42:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.242 2017/03/09 00:21:55 chs Exp $	*/
+/*	$NetBSD: pmap.c,v 1.243 2017/03/15 16:42:18 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.242 2017/03/09 00:21:55 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.243 2017/03/15 16:42:18 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -3882,6 +3882,12 @@ pmap_pv_clear_attrs(paddr_t pa, unsigned
 
 /*
  * pmap_write_protect: write-protect pages in a pmap.
+ *
+ * Note for Xen-amd64. Xen automatically adds PG_u to the kernel pages, but we
+ * don't need to remove this bit when re-entering the PTEs here: Xen tracks the
+ * kernel pages with a reserved bit (_PAGE_GUEST_KERNEL), so even if PG_u is
+ * present the page will still be considered as a kernel page, and the privilege
+ * separation will be enforced correctly.
  */
 void
 pmap_write_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)

Reply via email to