Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amd64/amd64 Treat page faults from iretq/etc as fat...



details:   https://anonhg.NetBSD.org/src/rev/28071546c059
branches:  trunk
changeset: 826424:28071546c059
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Sep 03 09:01:03 2017 +0000

description:
Treat page faults from iretq/etc as fatal, otherwise we could hide kernel
stack bugs. Note that it would be good to call check_swapgs from trap0e,
but a few things need to be fixed before that.

diffstat:

 sys/arch/amd64/amd64/trap.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r 959c2ad4aa83 -r 28071546c059 sys/arch/amd64/amd64/trap.c
--- a/sys/arch/amd64/amd64/trap.c       Sun Sep 03 08:52:18 2017 +0000
+++ b/sys/arch/amd64/amd64/trap.c       Sun Sep 03 09:01:03 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.97 2017/09/03 08:52:18 maxv Exp $   */
+/*     $NetBSD: trap.c,v 1.98 2017/09/03 09:01:03 maxv Exp $   */
 
 /*
  * Copyright (c) 1998, 2000, 2017 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.97 2017/09/03 08:52:18 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.98 2017/09/03 09:01:03 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -401,6 +401,7 @@
        case T_TSSFLT:
                if (p == NULL)
                        goto we_re_toast;
+
                /* Check for copyin/copyout fault. */
                onfault = onfault_handler(pcb, frame);
                if (onfault != NULL) {
@@ -412,7 +413,6 @@
                        return;
                }
 
-kernelfault:
                trap_user_kernelmode(frame, type, l, p);
                goto we_re_toast;
 
@@ -662,7 +662,7 @@
                                goto copyfault;
                        printf("uvm_fault(%p, 0x%lx, %d) -> %x\n",
                            map, va, ftype, error);
-                       goto kernelfault;
+                       goto we_re_toast;
                }
 
                KSI_INIT_TRAP(&ksi);



Home | Main Index | Thread Index | Old Index