summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-01-07 22:47:19 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-01-07 22:47:19 +0000
commit7651ba744afee68bf52b751d205928cd5a04d924 (patch)
tree7a47728af5cf9ab7167bf71f8eab15e8c2ab66fc
parent61d1ac075528509885ab5b04ebfc411ea7d73408 (diff)
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to
pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
-rw-r--r--sys/arch/m88k/m88k/trap.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c
index e8cca8c357e..b8ec416551f 100644
--- a/sys/arch/m88k/m88k/trap.c
+++ b/sys/arch/m88k/m88k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.83 2012/12/31 06:46:13 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.84 2013/01/07 22:47:18 miod Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -424,17 +424,15 @@ user_fault:
break;
default:
result = uvm_fault(map, va, VM_FAULT_INVALID, ftype);
+ if (result == EACCES)
+ result = EFAULT;
break;
}
p->p_addr->u_pcb.pcb_onfault = pcb_onfault;
- if ((caddr_t)va >= vm->vm_maxsaddr) {
- if (result == 0)
- uvm_grow(p, va);
- else if (result == EACCES)
- result = EFAULT;
- }
+ if (result == 0 && (caddr_t)va >= vm->vm_maxsaddr)
+ uvm_grow(p, va);
/*
* This could be a fault caused in copyin*()
@@ -903,6 +901,8 @@ m88110_user_fault:
if (frame->tf_isr & (CMMU_ISR_SI | CMMU_ISR_PI)) {
/* segment or page fault */
result = uvm_fault(map, va, VM_FAULT_INVALID, ftype);
+ if (result == EACCES)
+ result = EFAULT;
} else {
#ifdef TRAPDEBUG
printf("Unexpected Instruction fault isr %x\n",
@@ -920,6 +920,8 @@ m88110_user_fault:
if (frame->tf_dsr & (CMMU_DSR_SI | CMMU_DSR_PI)) {
/* segment or page fault */
result = uvm_fault(map, va, VM_FAULT_INVALID, ftype);
+ if (result == EACCES)
+ result = EFAULT;
} else
if (frame->tf_dsr & (CMMU_DSR_CP | CMMU_DSR_WA)) {
/* copyback or write allocate error */
@@ -950,6 +952,8 @@ m88110_user_fault:
map->pmap, va);
#endif
result = uvm_fault(map, va, VM_FAULT_INVALID, ftype);
+ if (result == EACCES)
+ result = EFAULT;
}
} else {
#ifdef TRAPDEBUG
@@ -962,12 +966,8 @@ m88110_user_fault:
}
p->p_addr->u_pcb.pcb_onfault = pcb_onfault;
- if ((caddr_t)va >= vm->vm_maxsaddr) {
- if (result == 0)
- uvm_grow(p, va);
- else if (result == EACCES)
- result = EFAULT;
- }
+ if (result == 0 && (caddr_t)va >= vm->vm_maxsaddr)
+ uvm_grow(p, va);
KERNEL_UNLOCK();
/*