Module Name:    src
Committed By:   matt
Date:           Thu Aug  2 13:50:15 UTC 2012

Modified Files:
        src/sys/arch/powerpc/booke: trap.c
        src/sys/arch/powerpc/powerpc: trap.c

Log Message:
Only print fatal trap info if the resulting signal would be uncaught.
(this avoid the messages from libcrypto when it probes for capabilities).


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/powerpc/booke/trap.c
cvs rdiff -u -r1.146 -r1.147 src/sys/arch/powerpc/powerpc/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/powerpc/booke/trap.c
diff -u src/sys/arch/powerpc/booke/trap.c:1.20 src/sys/arch/powerpc/booke/trap.c:1.21
--- src/sys/arch/powerpc/booke/trap.c:1.20	Wed Aug  1 21:30:22 2012
+++ src/sys/arch/powerpc/booke/trap.c	Thu Aug  2 13:50:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.20 2012/08/01 21:30:22 matt Exp $	*/
+/*	$NetBSD: trap.c,v 1.21 2012/08/02 13:50:15 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.20 2012/08/01 21:30:22 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.21 2012/08/02 13:50:15 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -877,7 +877,13 @@ trap(enum ppc_booke_exceptions trap_code
 			ksi.ksi_signo = SIGKILL;
 		}
 		if (rv != 0) {
-			if (cpu_printfataltraps) {
+			/*
+			 * Only print a fatal trap if the signal will be
+			 * uncaught.
+			 */
+			if (cpu_printfataltraps
+			    && !sigismember(&p->p_sigctx.ps_sigcatch,
+				    ksi.ksi_signo)) {
 				printf("%s: pid %d.%d (%s):"
 				    " %s exception in user mode\n",
 				    __func__, p->p_pid, l->l_lid, p->p_comm,

Index: src/sys/arch/powerpc/powerpc/trap.c
diff -u src/sys/arch/powerpc/powerpc/trap.c:1.146 src/sys/arch/powerpc/powerpc/trap.c:1.147
--- src/sys/arch/powerpc/powerpc/trap.c:1.146	Sun Feb 19 21:06:25 2012
+++ src/sys/arch/powerpc/powerpc/trap.c	Thu Aug  2 13:50:14 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.146 2012/02/19 21:06:25 rmind Exp $	*/
+/*	$NetBSD: trap.c,v 1.147 2012/08/02 13:50:14 matt Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.146 2012/02/19 21:06:25 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.147 2012/08/02 13:50:14 matt Exp $");
 
 #include "opt_altivec.h"
 #include "opt_ddb.h"
@@ -245,7 +245,8 @@ trap(struct trapframe *tf)
 			break;
 		}
 		ci->ci_ev_udsi_fatal.ev_count++;
-		if (cpu_printfataltraps) {
+		if (cpu_printfataltraps
+		    && !sigismember(&p->p_sigctx.ps_sigcatch, SIGSEGV)) {
 			printf("trap: pid %d.%d (%s): user %s DSI trap @ %#lx "
 			    "by %#lx (DSISR %#x, err=%d)\n",
 			    p->p_pid, l->l_lid, p->p_comm,
@@ -306,7 +307,8 @@ trap(struct trapframe *tf)
 			break;
 		}
 		ci->ci_ev_isi_fatal.ev_count++;
-		if (cpu_printfataltraps) {
+		if (cpu_printfataltraps
+		    && !sigismember(&p->p_sigctx.ps_sigcatch, SIGSEGV)) {
 			printf("trap: pid %d.%d (%s): user ISI trap @ %#lx "
 			    "(SRR1=%#lx)\n", p->p_pid, l->l_lid, p->p_comm,
 			    tf->tf_srr0, tf->tf_srr1);
@@ -332,7 +334,8 @@ trap(struct trapframe *tf)
 		ci->ci_ev_ali.ev_count++;
 		if (fix_unaligned(l, tf) != 0) {
 			ci->ci_ev_ali_fatal.ev_count++;
-			if (cpu_printfataltraps) {
+			if (cpu_printfataltraps
+			    && !sigismember(&p->p_sigctx.ps_sigcatch, SIGBUS)) {
 				printf("trap: pid %d.%d (%s): user ALI trap @ "
 				    "%#lx by %#lx (DSISR %#x)\n",
 				    p->p_pid, l->l_lid, p->p_comm,
@@ -356,7 +359,8 @@ trap(struct trapframe *tf)
 		vec_load();
 		break;
 #else
-		if (cpu_printfataltraps) {
+		if (cpu_printfataltraps
+		    && !sigismember(&p->p_sigctx.ps_sigcatch, SIGILL)) {
 			printf("trap: pid %d.%d (%s): user VEC trap @ %#lx "
 			    "(SRR1=%#lx)\n",
 			    p->p_pid, l->l_lid, p->p_comm,
@@ -372,7 +376,8 @@ trap(struct trapframe *tf)
 #endif
 	case EXC_MCHK|EXC_USER:
 		ci->ci_ev_umchk.ev_count++;
-		if (cpu_printfataltraps) {
+		if (cpu_printfataltraps
+		    && !sigismember(&p->p_sigctx.ps_sigcatch, SIGBUS)) {
 			printf("trap: pid %d (%s): user MCHK trap @ %#lx "
 			    "(SRR1=%#lx)\n",
 			    p->p_pid, p->p_comm, tf->tf_srr0, tf->tf_srr1);
@@ -416,10 +421,13 @@ trap(struct trapframe *tf)
 				ksi.ksi_code = ILL_PRVOPC;
 			} else
 				ksi.ksi_code = ILL_ILLOPC;
-			if (cpu_printfataltraps)
+			if (cpu_printfataltraps
+			    && !sigismember(&p->p_sigctx.ps_sigcatch,
+				    ksi.ksi_signo)) {
 				printf("trap: pid %d.%d (%s): user PGM trap @"
 				    " %#lx (SRR1=%#lx)\n", p->p_pid, l->l_lid,
 				    p->p_comm, tf->tf_srr0, tf->tf_srr1);
+			}
 			(*p->p_emul->e_trapsignal)(l, &ksi);
 		}
 		break;

Reply via email to