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 Move sanity check before pmap sin...



details:   https://anonhg.NetBSD.org/src/rev/7dfdcdaa435c
branches:  trunk
changeset: 769302:7dfdcdaa435c
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Tue Sep 06 09:38:27 2011 +0000

description:
Move sanity check before pmap since pmap and uvm can't be looking outside this
box

diffstat:

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

diffs (48 lines):

diff -r e1d763e2ada4 -r 7dfdcdaa435c sys/arch/usermode/usermode/trap.c
--- a/sys/arch/usermode/usermode/trap.c Tue Sep 06 09:37:41 2011 +0000
+++ b/sys/arch/usermode/usermode/trap.c Tue Sep 06 09:38:27 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.28 2011/09/05 21:38:05 jmcneill Exp $ */
+/* $NetBSD: trap.c,v 1.29 2011/09/06 09:38:27 reinoud 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.28 2011/09/05 21:38:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.29 2011/09/06 09:38:27 reinoud Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -165,6 +165,14 @@
                va = (vaddr_t) info->si_addr;
                va = trunc_page(va);
 
+               /* sanity */
+               if ((va < VM_MIN_ADDRESS) || (va >= VM_MAX_ADDRESS))
+                       panic("peeing outside the box! (va=%p)", (void *)va);
+
+               /* extra debug for now -> should issue signal */
+               if (va == 0)
+                       panic("NULL deref\n");
+
                kmem = 1;
                vm_map = kernel_map;
                if ((va >= VM_MIN_ADDRESS) && (va < VM_MAXUSER_ADDRESS)) {
@@ -187,14 +195,6 @@
                        pcb->pcb_onfault = onfault;
                }
 
-               /* sanity */
-               if ((va < VM_MIN_ADDRESS) || (va >= VM_MAX_ADDRESS))
-                       panic("peeing outside the box! (va=%p)", (void *)va);
-
-               /* extra debug for now */
-               if (va == 0)
-                       panic("NULL deref\n");
-
 #if 0
        if (old_old_va)
                thunk_pwrite(debug_fh, (void *) old_old_va, PAGE_SIZE, old_old_va);



Home | Main Index | Thread Index | Old Index