diff options
author | 2017-07-22 15:20:11 +0000 | |
---|---|---|
committer | 2017-07-22 15:20:11 +0000 | |
commit | 5507416cb53cad802768a3bd4baf91f31cf14a9c (patch) | |
tree | 2dacc08d32f38fe10ef300ec3d15e4da1203f662 | |
parent | Fix the various SIGSEGV and SIGBUS scenarios to match what we do on (diff) | |
download | wireguard-openbsd-5507416cb53cad802768a3bd4baf91f31cf14a9c.tar.xz wireguard-openbsd-5507416cb53cad802768a3bd4baf91f31cf14a9c.zip |
Fix the various SIGSEGV and SIGBUS scenarios to match what we do on
amd64/arm64/armv7/i386/sparc64.
ok visa@
-rw-r--r-- | sys/arch/hppa/hppa/trap.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c index 1182d837fe4..b58f2c9158d 100644 --- a/sys/arch/hppa/hppa/trap.c +++ b/sys/arch/hppa/hppa/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.141 2016/10/19 08:31:32 guenther Exp $ */ +/* $OpenBSD: trap.c,v 1.142 2017/07/22 15:20:11 kettenis Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -513,23 +513,27 @@ datacc: * the current limit and we need to reflect that as an access * error. */ - if (space != HPPA_SID_KERNEL && - va < (vaddr_t)vm->vm_minsaddr) { - if (ret == 0) - uvm_grow(p, va); - else if (ret == EACCES) - ret = EFAULT; - } + if (ret == 0 && space != HPPA_SID_KERNEL && + va < (vaddr_t)vm->vm_minsaddr) + uvm_grow(p, va); KERNEL_UNLOCK(); if (ret != 0) { if (type & T_USER) { + int signal, sicode; + + signal = SIGSEGV; + sicode = SEGV_MAPERR; + if (ret == EACCES) + sicode = SEGV_ACCERR; + if (ret == EIO) { + signal = SIGBUS; + sicode = BUS_OBJERR; + } sv.sival_int = va; KERNEL_LOCK(); - trapsignal(p, SIGSEGV, vftype, - ret == EACCES? SEGV_ACCERR : SEGV_MAPERR, - sv); + trapsignal(p, signal, vftype, sicode, sv); KERNEL_UNLOCK(); } else { if (p && p->p_addr->u_pcb.pcb_onfault) { |