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 When a user pmap is created, it is populate...



details:   https://anonhg.NetBSD.org/src/rev/82c5e5c727bb
branches:  trunk
changeset: 346350:82c5e5c727bb
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Jul 09 08:05:46 2016 +0000

description:
When a user pmap is created, it is populated with the higher kernel
slots, which become accessible upon kernel entry (syscall, cpu switch,
or whatever). Put the NOX bit in the user recursive slot, so the whole
tree does not appear as executable in kernel mode.

This is already what is done in the kernel pmap.

diffstat:

 sys/arch/x86/x86/pmap.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 0c53cfc160f8 -r 82c5e5c727bb sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Sat Jul 09 07:47:25 2016 +0000
+++ b/sys/arch/x86/x86/pmap.c   Sat Jul 09 08:05:46 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.207 2016/07/09 07:47:25 maxv Exp $  */
+/*     $NetBSD: pmap.c,v 1.208 2016/07/09 08:05:46 maxv Exp $  */
 
 /*-
  * Copyright (c) 2008, 2010, 2016 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207 2016/07/09 07:47:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.208 2016/07/09 08:05:46 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -2164,7 +2164,8 @@
                (void)pmap_extract(pmap_kernel(), object, &pdirpa);
 
                /* Put in recursive PDE to map the PTEs */
-               pdir[PDIR_SLOT_PTE + i] = pmap_pa2pte(pdirpa) | PG_V;
+               pdir[PDIR_SLOT_PTE + i] = pmap_pa2pte(pdirpa) | PG_V |
+                   pmap_pg_nx;
 #ifndef XEN
                pdir[PDIR_SLOT_PTE + i] |= PG_KW;
 #endif



Home | Main Index | Thread Index | Old Index