summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2003-01-08 07:00:59 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2003-01-08 07:00:59 +0000
commitf9b137bf2fd29c07cde0bba4cc9ff3713926504c (patch)
tree2004c191e85ce9e253f529a48327a58d595051a0 /sys
parent93ffd28c1e8b97780c028b3ef1bd8cf2f20c9391 (diff)
make sure we are not allowing user to fault outside user address space and always print smth before dead_end
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/hppa/hppa/trap.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c
index fe41cf678ae..f320cbcd698 100644
--- a/sys/arch/hppa/hppa/trap.c
+++ b/sys/arch/hppa/hppa/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.56 2003/01/07 19:39:26 mickey Exp $ */
+/* $OpenBSD: trap.c,v 1.57 2003/01/08 07:00:58 mickey Exp $ */
/*
* Copyright (c) 1998-2001 Michael Shalayeff
@@ -200,22 +200,15 @@ trap(type, frame)
switch (type) {
case T_NONEXIST:
case T_NONEXIST|T_USER:
-#ifndef DDB
/* we've got screwed up by the central scrutinizer */
- panic ("trap: elvis has just left the building!");
- break;
-#else
+ printf("trap: elvis has just left the building!\n");
goto dead_end;
-#endif
+
case T_RECOVERY:
case T_RECOVERY|T_USER:
-#ifndef DDB
/* XXX will implement later */
- printf ("trap: handicapped");
- break;
-#else
+ printf("trap: handicapped");
goto dead_end;
-#endif
#ifdef DIAGNOSTIC
case T_EXCEPTION:
@@ -249,6 +242,9 @@ trap(type, frame)
break;
case T_IBREAK | T_USER:
+ /* XXX */
+ frame->tf_iioq_head = frame->tf_iioq_tail;
+ frame->tf_iioq_tail += 4;
case T_DBREAK | T_USER:
/* pass to user debugger */
break;
@@ -340,12 +336,20 @@ trap(type, frame)
case T_ITLBMISSNA: case T_USER | T_ITLBMISSNA:
case T_DTLBMISSNA: case T_USER | T_DTLBMISSNA:
case T_TLB_DIRTY: case T_USER | T_TLB_DIRTY:
- vm = p->p_vmspace;
+ /*
+ * user faults out of user addr space are always a fail,
+ * this happens on va >= VM_MAXUSER_ADDRESS, where
+ * space id will be zero and therefore cause
+ * a misbehave lower in the code.
+ */
+ if (type & T_USER && va >= VM_MAXUSER_ADDRESS) {
+ sv.sival_int = va;
+ trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, sv);
+ break;
+ }
- if (!vm) {
-#ifdef TRAPDEBUG
+ if (!(vm = p->p_vmspace)) {
printf("trap: no vm, p=%p\n", p);
-#endif
goto dead_end;
}
@@ -358,10 +362,8 @@ trap(type, frame)
map = &vm->vm_map;
if (map->pmap->pm_space != space) {
-#ifdef TRAPDEBUG
printf("trap: space missmatch %d != %d\n",
space, map->pmap->pm_space);
-#endif
/* actually dump the user, crap the kernel */
goto dead_end;
}