summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvisa <visa@openbsd.org>2017-07-22 16:44:15 +0000
committervisa <visa@openbsd.org>2017-07-22 16:44:15 +0000
commit179dc0ce83e5bc5de3f049228aea9bc918a50ae5 (patch)
tree0be9c790bc57755a45fe9590a412195d71d10c25
parentno need to cast signal(3) and fprintf(3) return values to (void) (diff)
downloadwireguard-openbsd-179dc0ce83e5bc5de3f049228aea9bc918a50ae5.tar.xz
wireguard-openbsd-179dc0ce83e5bc5de3f049228aea9bc918a50ae5.zip
Bring SIGBUS and SIGSEGV handling better in line with the other
architectures. OK kettenis@, deraadt@
-rw-r--r--sys/arch/mips64/mips64/trap.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c
index 762141db48c..2ab8fbf3e29 100644
--- a/sys/arch/mips64/mips64/trap.c
+++ b/sys/arch/mips64/mips64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.125 2017/07/03 16:37:07 visa Exp $ */
+/* $OpenBSD: trap.c,v 1.126 2017/07/22 16:44:15 visa Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -420,12 +420,9 @@ fault_common_no_miss:
* the current limit and we need to reflect that as an access
* error.
*/
- if ((caddr_t)va >= vm->vm_maxsaddr) {
- if (rv == 0)
- uvm_grow(p, va);
- else if (rv == EACCES)
- rv = EFAULT;
- }
+ if (rv == 0 && (caddr_t)va >= vm->vm_maxsaddr)
+ uvm_grow(p, va);
+
KERNEL_UNLOCK();
if (rv == 0)
return;
@@ -441,6 +438,12 @@ fault_common_no_miss:
ucode = ftype;
i = SIGSEGV;
typ = SEGV_MAPERR;
+ if (rv == EACCES)
+ typ = SEGV_ACCERR;
+ if (rv == EIO) {
+ i = SIGBUS;
+ typ = BUS_OBJERR;
+ }
break;
}