Module Name: src Committed By: reinoud Date: Tue Sep 6 09:38:27 UTC 2011
Modified Files: src/sys/arch/usermode/usermode: trap.c Log Message: Move sanity check before pmap since pmap and uvm can't be looking outside this box To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/usermode/usermode/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/usermode/usermode/trap.c diff -u src/sys/arch/usermode/usermode/trap.c:1.28 src/sys/arch/usermode/usermode/trap.c:1.29 --- src/sys/arch/usermode/usermode/trap.c:1.28 Mon Sep 5 21:38:05 2011 +++ src/sys/arch/usermode/usermode/trap.c Tue Sep 6 09:38:27 2011 @@ -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 <rein...@netbsd.org> @@ -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);