Source-Changes-HG archive

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

[src/trunk]: src/sys/arch The CPU considers a given va as executable if none ...



details:   https://anonhg.NetBSD.org/src/rev/cdbddb26d76c
branches:  trunk
changeset: 346347:cdbddb26d76c
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Jul 09 06:58:06 2016 +0000

description:
The CPU considers a given va as executable if none of its levels have
the NOX bit. With the top level recursive slot, however, several levels
are recursively omitted, which implies that each entry that is not the
child of NOX-ed parents actually appears somewhere in the virtual space
as executable via this slot, even if it is followed by an underlying
entry that has the NOX bit.

This recursive slot is only used to edit the page tree itself. Make it
non-executable.

diffstat:

 sys/arch/amd64/amd64/locore.S |  8 ++++----
 sys/arch/i386/i386/locore.S   |  8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diffs (58 lines):

diff -r 63033f5633ac -r cdbddb26d76c sys/arch/amd64/amd64/locore.S
--- a/sys/arch/amd64/amd64/locore.S     Sat Jul 09 06:49:03 2016 +0000
+++ b/sys/arch/amd64/amd64/locore.S     Sat Jul 09 06:58:06 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.105 2016/07/08 09:15:38 maxv Exp $        */
+/*     $NetBSD: locore.S,v 1.106 2016/07/09 06:58:06 maxv Exp $        */
 
 /*
  * Copyright-o-rama!
@@ -777,12 +777,12 @@
        movl    $NKL4_KIMG_ENTRIES,%ecx
        fillkpt
 
-       /* Install recursive top level PDE */
+       /* Install recursive top level PDE (one entry) */
        leal    (PROC0_PML4_OFF + PDIR_SLOT_PTE * PDE_SIZE)(%esi),%ebx
        leal    (PROC0_PML4_OFF)(%esi),%eax
        orl     $(PG_V|PG_KW),%eax
-       movl    %eax,(%ebx)
-       movl    $0,(PDE_SIZE-4)(%ebx)
+       movl    $1,%ecx
+       fillkpt_nox
 
        /*
         * Startup checklist:
diff -r 63033f5633ac -r cdbddb26d76c sys/arch/i386/i386/locore.S
--- a/sys/arch/i386/i386/locore.S       Sat Jul 09 06:49:03 2016 +0000
+++ b/sys/arch/i386/i386/locore.S       Sat Jul 09 06:58:06 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.134 2016/07/08 09:15:38 maxv Exp $        */
+/*     $NetBSD: locore.S,v 1.135 2016/07/09 06:58:06 maxv Exp $        */
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.134 2016/07/08 09:15:38 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.135 2016/07/09 06:58:06 maxv Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -776,12 +776,12 @@
        movl    RELOC(nkptp)+1*4,%ecx
        fillkpt
 
-       /* Install a PDE recursively mapping page directory as a page table! */
+       /* Install recursive top level PDE */
        leal    (PROC0_PDIR_OFF + PDIR_SLOT_PTE * PDE_SIZE)(%esi),%ebx
        leal    (PROC0_PDIR_OFF)(%esi),%eax
        orl     $(PG_V|PG_KW),%eax
        movl    $PDP_SIZE,%ecx
-       fillkpt
+       fillkpt_nox
 
 #ifdef PAE
        /*



Home | Main Index | Thread Index | Old Index