summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_trap.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1996-12-18 19:12:01 +0000
committerbde <bde@FreeBSD.org>1996-12-18 19:12:01 +0000
commit6a187caa328aee45bc40aa33eb0de1dde182cbf1 (patch)
treef73890868dde2e3b877b97c6e6f77e1ba5e3938f /sys/kern/subr_trap.c
parent7e08a625a481937f143a17fa0d6974ca34cdc63e (diff)
downloadFreeBSD-src-6a187caa328aee45bc40aa33eb0de1dde182cbf1.zip
FreeBSD-src-6a187caa328aee45bc40aa33eb0de1dde182cbf1.tar.gz
Only handle copyin/out/etc faults when not in an interrupt handler.
This makes unexpected faults (in an interrupt handler) more likely to crash properly. It could be done even better (more robustly and more efficiently) using lazy fault handling.
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r--sys/kern/subr_trap.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index c86e7fd..e976df5 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_trap.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
- * $Id: trap.c,v 1.82 1996/09/01 10:10:12 davidg Exp $
+ * $Id: trap.c,v 1.83 1996/09/10 08:32:01 bde Exp $
*/
/*
@@ -350,10 +350,10 @@ trap(frame)
doreti_popl_ds_fault);
MAYBE_DORETI_FAULT(doreti_popl_es,
doreti_popl_es_fault);
- }
- if (curpcb && curpcb->pcb_onfault) {
- frame.tf_eip = (int)curpcb->pcb_onfault;
- return;
+ if (curpcb && curpcb->pcb_onfault) {
+ frame.tf_eip = (int)curpcb->pcb_onfault;
+ return;
+ }
}
break;
@@ -493,7 +493,8 @@ trap_pfault(frame, usermode)
if (p == NULL ||
(!usermode && va < VM_MAXUSER_ADDRESS &&
- (curpcb == NULL || curpcb->pcb_onfault == NULL))) {
+ (intr_nesting_level != 0 || curpcb == NULL ||
+ curpcb->pcb_onfault == NULL))) {
trap_fatal(frame);
return (-1);
}
@@ -550,7 +551,7 @@ trap_pfault(frame, usermode)
return (0);
nogo:
if (!usermode) {
- if (curpcb && curpcb->pcb_onfault) {
+ if (intr_nesting_level == 0 && curpcb && curpcb->pcb_onfault) {
frame->tf_eip = (int)curpcb->pcb_onfault;
return (0);
}
@@ -645,7 +646,7 @@ trap_pfault(frame, usermode)
return (0);
nogo:
if (!usermode) {
- if (curpcb && curpcb->pcb_onfault) {
+ if (intr_nesting_level == 0 && curpcb && curpcb->pcb_onfault) {
frame->tf_eip = (int)curpcb->pcb_onfault;
return (0);
}
OpenPOWER on IntegriCloud