Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Use common code for SMEP/SMAP panic to print more i...



details:   https://anonhg.NetBSD.org/src/rev/7f4c2a3f1f40
branches:  trunk
changeset: 1000199:7f4c2a3f1f40
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Jul 13 17:03:01 2019 +0000

description:
Use common code for SMEP/SMAP panic to print more information and
allow debugging.

diffstat:

 sys/arch/amd64/amd64/trap.c |  17 +++++++----------
 sys/arch/i386/i386/trap.c   |  13 ++++++++-----
 2 files changed, 15 insertions(+), 15 deletions(-)

diffs (89 lines):

diff -r 5e7c245b9ee5 -r 7f4c2a3f1f40 sys/arch/amd64/amd64/trap.c
--- a/sys/arch/amd64/amd64/trap.c       Sat Jul 13 14:24:37 2019 +0000
+++ b/sys/arch/amd64/amd64/trap.c       Sat Jul 13 17:03:01 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.120 2019/05/15 13:49:10 christos Exp $      */
+/*     $NetBSD: trap.c,v 1.121 2019/07/13 17:03:01 mlelstv 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.120 2019/05/15 13:49:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.121 2019/07/13 17:03:01 mlelstv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -481,13 +481,9 @@
                if (frame->tf_err & PGEX_X) {
                        /* SMEP might have brought us here */
                        if (cr2 < VM_MAXUSER_ADDRESS) {
-                               if (cr2 == 0)
-                                       panic("prevented jump to null"
-                                           " instruction pointer (SMEP)");
-                               else
-                                       panic("prevented execution of"
-                                           " user address %p (SMEP)",
-                                           (void *)cr2);
+                               printf("prevented execution of %p (SMEP)\n",
+                                   (void *)cr2);
+                               goto we_re_toast;
                        }
                }
 
@@ -495,8 +491,9 @@
                    cr2 < VM_MAXUSER_ADDRESS) {
                        /* SMAP might have brought us here */
                        if (onfault_handler(pcb, frame) == NULL) {
-                               panic("prevented access to %p (SMAP)",
+                               printf("prevented access to %p (SMAP)\n",
                                    (void *)cr2);
+                               goto we_re_toast;
                        }
                }
 
diff -r 5e7c245b9ee5 -r 7f4c2a3f1f40 sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Sat Jul 13 14:24:37 2019 +0000
+++ b/sys/arch/i386/i386/trap.c Sat Jul 13 17:03:01 2019 +0000
@@ -1,5 +1,5 @@
 
-/*     $NetBSD: trap.c,v 1.301 2019/05/29 14:28:37 msaitoh Exp $       */
+/*     $NetBSD: trap.c,v 1.302 2019/07/13 17:04:21 mlelstv Exp $       */
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.301 2019/05/29 14:28:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.302 2019/07/13 17:04:21 mlelstv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -582,17 +582,20 @@
 
                if (frame->tf_err & PGEX_X) {
                        /* SMEP might have brought us here */
-                       if (cr2 > VM_MIN_ADDRESS && cr2 <= VM_MAXUSER_ADDRESS)
-                               panic("prevented execution of %p (SMEP)",
+                       if (cr2 > VM_MIN_ADDRESS && cr2 <= VM_MAXUSER_ADDRESS) {
+                               printf("prevented execution of %p (SMEP)\n",
                                    (void *)cr2);
+                               goto we_re_toast;
+                       }
                }
 
                if ((frame->tf_err & PGEX_P) &&
                    cr2 < VM_MAXUSER_ADDRESS) {
                        /* SMAP might have brought us here */
                        if (onfault_handler(pcb, frame) == NULL) {
-                               panic("prevented access to %p (SMAP)",
+                               printf("prevented access to %p (SMAP)\n",
                                    (void *)cr2);
+                               goto we_re_toast;
                        }
                }
 



Home | Main Index | Thread Index | Old Index