diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-10-08 15:57:54 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-10-08 15:57:54 +0000 |
commit | 13ef37237eec7d4bea053746e262773c3e4a7c13 (patch) | |
tree | 5a5fb5aa6604eb4d3bda3570c8af6d41a3931f5b /sys/arch/arm64 | |
parent | 71b22c384c215bc4dca9523f0011c658d63db90e (diff) |
Generate SIGBUS when we see a data abort exception because of unaligned
access instead of spinning forever. Fix a weird cast in related code while
I'm there.
ok visa@ deraadt@
Diffstat (limited to 'sys/arch/arm64')
-rw-r--r-- | sys/arch/arm64/arm64/trap.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/sys/arch/arm64/arm64/trap.c b/sys/arch/arm64/arm64/trap.c index 56000bcaec6..d36e91b049c 100644 --- a/sys/arch/arm64/arm64/trap.c +++ b/sys/arch/arm64/arm64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.20 2018/08/03 18:36:01 kettenis Exp $ */ +/* $OpenBSD: trap.c,v 1.21 2018/10/08 15:57:53 kettenis Exp $ */ /*- * Copyright (c) 2014 Andrew Turner * All rights reserved. @@ -90,6 +90,19 @@ data_abort(struct trapframe *frame, uint64_t esr, uint64_t far, if (va >= VM_MAXUSER_ADDRESS) curcpu()->ci_flush_bp(); + if (lower) { + switch (esr & ISS_DATA_DFSC_MASK) { + case ISS_DATA_DFSC_ALIGN: + sv.sival_ptr = (void *)far; + KERNEL_LOCK(); + trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv); + KERNEL_UNLOCK(); + return; + default: + break; + } + } + if (lower) map = &p->p_vmspace->vm_map; else { @@ -141,7 +154,7 @@ data_abort(struct trapframe *frame, uint64_t esr, uint64_t far, sig = SIGSEGV; code = SEGV_MAPERR; } - sv.sival_ptr = (u_int64_t *)far; + sv.sival_ptr = (void *)far; KERNEL_LOCK(); trapsignal(p, sig, 0, code, sv); |