Module Name: src Committed By: maxv Date: Sat Jul 9 08:05:47 UTC 2016
Modified Files: src/sys/arch/x86/x86: pmap.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.207 -r1.208 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.207 src/sys/arch/x86/x86/pmap.c:1.208 --- src/sys/arch/x86/x86/pmap.c:1.207 Sat Jul 9 07:47:25 2016 +++ src/sys/arch/x86/x86/pmap.c Sat Jul 9 08:05:46 2016 @@ -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 @@ pmap_pdp_ctor(void *arg, void *v, int fl (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