Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/usermode/usermode mem_access_handler: panic if we r...



details:   https://anonhg.NetBSD.org/src/rev/2d95c0243dce
branches:  trunk
changeset: 769231:2d95c0243dce
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Sep 04 12:17:59 2011 +0000

description:
mem_access_handler: panic if we receive sigsegv or sigbus with SI_NOINFO,
and when "peeing outside the box" print the offending va

diffstat:

 sys/arch/usermode/usermode/trap.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r 9b715925bd39 -r 2d95c0243dce sys/arch/usermode/usermode/trap.c
--- a/sys/arch/usermode/usermode/trap.c Sun Sep 04 12:17:46 2011 +0000
+++ b/sys/arch/usermode/usermode/trap.c Sun Sep 04 12:17:59 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.20 2011/09/03 15:33:56 reinoud Exp $ */
+/* $NetBSD: trap.c,v 1.21 2011/09/04 12:17:59 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk <reinoud%netbsd.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.20 2011/09/03 15:33:56 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.21 2011/09/04 12:17:59 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -152,6 +152,10 @@
                printf("\tsi_trap = %d\n", info->si_trap);
 #endif
 
+               if (info->si_code == SI_NOINFO)
+                       panic("received signal %d with no info",
+                           info->si_signo);
+
                va = (vaddr_t) info->si_addr;
                va = trunc_page(va);
 
@@ -174,7 +178,7 @@
 
                /* sanity */
                if ((va < VM_MIN_ADDRESS) || (va >= VM_MAX_ADDRESS))
-                       panic("peeing outside the box!");
+                       panic("peeing outside the box! (va=%p)", (void *)va);
 
                /* extra debug for now */
                if (va == 0)



Home | Main Index | Thread Index | Old Index