summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2017-07-20 19:57:36 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2017-07-20 19:57:36 +0000
commitf3ec5a017bfbd064afdb5c4f14cf1dd46207401d (patch)
treea2829e45f4edbf0f3ad50cacdd533176f1899db9 /sys
parent8e22a09d2fc9bd6adc0f977667a5970fddee2b0f (diff)
Bring SIBUS/SIGSEGV reporting in line with amd64 and i386.
ok deraadt@, bluhm@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/arm64/arm64/trap.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/arch/arm64/arm64/trap.c b/sys/arch/arm64/arm64/trap.c
index cec2e0ba5b0..df83fbc4010 100644
--- a/sys/arch/arm64/arm64/trap.c
+++ b/sys/arch/arm64/arm64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.7 2017/04/29 17:10:43 kettenis Exp $ */
+/* $OpenBSD: trap.c,v 1.8 2017/07/20 19:57:35 kettenis Exp $ */
/*-
* Copyright (c) 2014 Andrew Turner
* All rights reserved.
@@ -136,7 +136,7 @@ data_abort(struct trapframe *frame, uint64_t esr, int lower, int exe)
vaddr_t va;
union sigval sv;
uint64_t far;
- int error = 0, sig;
+ int error = 0, sig, code;
pcb = curcpu()->ci_curpcb;
p = curcpu()->ci_curproc;
@@ -191,13 +191,22 @@ data_abort(struct trapframe *frame, uint64_t esr, int lower, int exe)
if (error != 0) {
if (lower) {
- if (error == ENOMEM)
+ if (error == ENOMEM) {
sig = SIGKILL;
- else
+ code = 0;
+ } else if (error == EIO) {
+ sig = SIGBUS;
+ code = BUS_OBJERR;
+ } else if (error == EACCES) {
sig = SIGSEGV;
+ code = SEGV_ACCERR;
+ } else {
+ sig = SIGSEGV;
+ code = SEGV_MAPERR;
+ }
sv.sival_ptr = (u_int64_t *)far;
- trapsignal(p, sig, 0, SEGV_ACCERR, sv);
+ trapsignal(p, sig, 0, code, sv);
} else {
if (curcpu()->ci_idepth == 0 &&
pcb->pcb_onfault != 0) {