Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/arch/amd64/amd64 Pull up following revision(s) (reque...



details:   https://anonhg.NetBSD.org/src/rev/4563e11fae56
branches:  netbsd-7
changeset: 800197:4563e11fae56
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Apr 26 14:52:50 2017 +0000

description:
Pull up following revision(s) (requested by bsiegert in ticket #1397):

        sys/arch/amd64/amd64/locore.S                   1.122 (via patch)
        sys/arch/amd64/amd64/machdep.c                  1.254 (via patch)
        sys/arch/amd64/amd64/trap.c                     1.95 (via patch)

Remove the call gate on amd64, it is useless and vulnerable.

diffstat:

 sys/arch/amd64/amd64/locore.S  |  23 +----------------------
 sys/arch/amd64/amd64/machdep.c |  19 +++----------------
 sys/arch/amd64/amd64/trap.c    |   8 +++-----
 3 files changed, 7 insertions(+), 43 deletions(-)

diffs (120 lines):

diff -r c5c6453675f4 -r 4563e11fae56 sys/arch/amd64/amd64/locore.S
--- a/sys/arch/amd64/amd64/locore.S     Fri Apr 21 05:24:01 2017 +0000
+++ b/sys/arch/amd64/amd64/locore.S     Wed Apr 26 14:52:50 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.76 2014/05/16 00:48:41 rmind Exp $        */
+/*     $NetBSD: locore.S,v 1.76.2.1 2017/04/26 14:52:50 martin Exp $   */
 
 /*
  * Copyright-o-rama!
@@ -1287,27 +1287,6 @@
 END(lwp_trampoline)
 
 /*
- * oosyscall()
- *
- * Old call gate entry for syscall. only needed if we're
- * going to support running old i386 NetBSD 1.0 or ibcs2 binaries, etc,
- * on NetBSD/amd64.
- * The 64bit call gate can't request that arguments be copied from the
- * user stack (which the i386 code uses to get a gap for the flags).
- * push/pop are <read>:<modify_sp>:<write> cycles.
- */
-IDTVEC(oosyscall)
-       /* Set rflags in trap frame. */
-       pushq   (%rsp)          # move user's %eip
-       pushq   16(%rsp)        # and %cs
-       popq    8(%rsp)
-       pushfq
-       popq    16(%rsp)
-       pushq   $7              # size of instruction for restart
-       jmp     osyscall1
-IDTVEC_END(oosyscall)
-
-/*
  * osyscall()
  *
  * Trap gate entry for int $80 syscall, also used by sigreturn.
diff -r c5c6453675f4 -r 4563e11fae56 sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c    Fri Apr 21 05:24:01 2017 +0000
+++ b/sys/arch/amd64/amd64/machdep.c    Wed Apr 26 14:52:50 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.211 2014/05/12 22:50:03 uebayasi Exp $   */
+/*     $NetBSD: machdep.c,v 1.211.2.1 2017/04/26 14:52:50 martin Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.211 2014/05/12 22:50:03 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.211.2.1 2017/04/26 14:52:50 martin Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -1696,10 +1696,7 @@
        set_mem_segment(GDT_ADDR_MEM(gdtstore, GUDATA_SEL), 0,
            x86_btop(VM_MAXUSER_ADDRESS) - 1, SDT_MEMRWA, SEL_UPL, 1, 0, 1);
 
-       /* make ldt gates and memory segments */
-       setgate((struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-           &IDTVEC(oosyscall), 0, SDT_SYS386CGT, SEL_UPL,
-           GSEL(GCODE_SEL, SEL_KPL));
+       /* make ldt memory segments */
        *(struct mem_segment_descriptor *)(ldtstore + LUCODE_SEL) =
            *GDT_ADDR_MEM(gdtstore, GUCODE_SEL);
        *(struct mem_segment_descriptor *)(ldtstore + LUDATA_SEL) =
@@ -1731,16 +1728,6 @@
        set_mem_segment(ldt_segp, 0, x86_btop(VM_MAXUSER_ADDRESS32) - 1,
            SDT_MEMRWA, SEL_UPL, 1, 1, 0);
 
-       /*
-        * Other entries.
-        */
-       memcpy((struct gate_descriptor *)(ldtstore + LSOL26CALLS_SEL),
-           (struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-           sizeof (struct gate_descriptor));
-       memcpy((struct gate_descriptor *)(ldtstore + LBSDICALLS_SEL),
-           (struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL),
-           sizeof (struct gate_descriptor));
-
        /* exceptions */
        for (x = 0; x < 32; x++) {
 #ifndef XEN
diff -r c5c6453675f4 -r 4563e11fae56 sys/arch/amd64/amd64/trap.c
--- a/sys/arch/amd64/amd64/trap.c       Fri Apr 21 05:24:01 2017 +0000
+++ b/sys/arch/amd64/amd64/trap.c       Wed Apr 26 14:52:50 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.78.4.1 2017/03/25 16:57:39 snj Exp $        */
+/*     $NetBSD: trap.c,v 1.78.4.2 2017/04/26 14:52:50 martin Exp $     */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.4.1 2017/03/25 16:57:39 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78.4.2 2017/04/26 14:52:50 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -222,7 +222,6 @@
        struct proc *p;
        struct pcb *pcb;
        extern char fusuintrfailure[], kcopy_fault[];
-       extern char IDTVEC(oosyscall)[];
        extern char IDTVEC(osyscall)[];
        extern char IDTVEC(syscall32)[];
 #ifndef XEN
@@ -647,8 +646,7 @@
 
        case T_TRCTRAP:
                /* Check whether they single-stepped into a lcall. */
-               if (frame->tf_rip == (uint64_t)IDTVEC(oosyscall) ||
-                   frame->tf_rip == (uint64_t)IDTVEC(osyscall) ||
+               if (frame->tf_rip == (uint64_t)IDTVEC(osyscall) ||
                    frame->tf_rip == (uint64_t)IDTVEC(syscall32)) {
                        frame->tf_rflags &= ~PSL_T;
                        return;



Home | Main Index | Thread Index | Old Index