Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 Add a comment to answer a question regardin...



details:   https://anonhg.NetBSD.org/src/rev/2497f540edb2
branches:  trunk
changeset: 822350:2497f540edb2
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Mar 15 16:42:18 2017 +0000

description:
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.

diffstat:

 sys/arch/x86/x86/pmap.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r cd753a0e35df -r 2497f540edb2 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Wed Mar 15 15:33:54 2017 +0000
+++ b/sys/arch/x86/x86/pmap.c   Wed Mar 15 16:42:18 2017 +0000
@@ -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_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)



Home | Main Index | Thread Index | Old Index