Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/aarch64/aarch64 Implement sigill_debug variable for...



details:   https://anonhg.NetBSD.org/src/rev/fe3ae8b962f0
branches:  trunk
changeset: 834108:fe3ae8b962f0
user:      ryo <ryo%NetBSD.org@localhost>
date:      Sat Jul 28 09:57:59 2018 +0000

description:
Implement sigill_debug variable for debug (with DDB). if sigill_debug = 1, illegal instruction will be logged.

e.g.) [ 75914.9966392] TRAP: pid 1422 (ssh), uid 1074: Unknown Reason (Illegal Instruction): pc=0x0000faa29ae35088: pmull v0.1q, v0.1d, v0.1d

diffstat:

 sys/arch/aarch64/aarch64/trap.c |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (50 lines):

diff -r e4430ca8124e -r fe3ae8b962f0 sys/arch/aarch64/aarch64/trap.c
--- a/sys/arch/aarch64/aarch64/trap.c   Sat Jul 28 09:54:32 2018 +0000
+++ b/sys/arch/aarch64/aarch64/trap.c   Sat Jul 28 09:57:59 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.7 2018/07/19 18:30:28 christos Exp $ */
+/* $NetBSD: trap.c,v 1.8 2018/07/28 09:57:59 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,12 +31,13 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.7 2018/07/19 18:30:28 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.8 2018/07/28 09:57:59 ryo Exp $");
 
 #include "opt_arm_intr_impl.h"
 #include "opt_compat_netbsd32.h"
 
 #include <sys/param.h>
+#include <sys/kauth.h>
 #include <sys/types.h>
 #include <sys/atomic.h>
 #include <sys/cpu.h>
@@ -73,6 +74,9 @@
 #include <machine/db_machdep.h>
 #endif
 
+#ifdef DDB
+int sigill_debug = 0;
+#endif
 
 const char * const trap_names[] = {
        [ESR_EC_UNKNOWN]        = "Unknown Reason (Illegal Instruction)",
@@ -271,6 +275,15 @@
        default:
                /* XXX notyet */
        case ESR_EC_UNKNOWN:
+#ifdef DDB
+               if (sigill_debug) {
+                       /* show illegal instruction */
+                       printf("TRAP: pid %d (%s), uid %d: %s: pc=0x%016lx: %s\n",
+                           curlwp->l_proc->p_pid, curlwp->l_proc->p_comm,
+                           l->l_cred ? kauth_cred_geteuid(l->l_cred) : -1,
+                           eclass_trapname(eclass), tf->tf_pc, strdisasm(tf->tf_pc));
+               }
+#endif
                /* illegal or not implemented instruction */
                do_trapsignal(l, SIGILL, ILL_ILLTRP, (void *)tf->tf_pc, esr);
                userret(l);



Home | Main Index | Thread Index | Old Index