diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2020-03-13 08:46:51 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2020-03-13 08:46:51 +0000 |
commit | df68a94e7fec9a4b2a947c4fbb307bb4520e4d6b (patch) | |
tree | 6acb680b92055b55bd49cc11eb946d9f315260c2 /sys/arch/arm | |
parent | ea591887297d6660af3c55032f41c0c1382281a3 (diff) |
Anthony Steinhauser reports that 32-bit arm cpus have the same speculation
problems as 64-bit models. All syscall instructions ("swi 0") now have a
nop;nop after them. We make the kernel skip over these when returning, so
that we can (soon) change the nops into a speculation barrier.
ok kettenis
Diffstat (limited to 'sys/arch/arm')
-rw-r--r-- | sys/arch/arm/arm/sigcode.S | 7 | ||||
-rw-r--r-- | sys/arch/arm/arm/syscall.c | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/sys/arch/arm/arm/sigcode.S b/sys/arch/arm/arm/sigcode.S index 447534c620f..9637bbef6db 100644 --- a/sys/arch/arm/arm/sigcode.S +++ b/sys/arch/arm/arm/sigcode.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigcode.S,v 1.8 2020/03/11 13:42:15 deraadt Exp $ */ +/* $OpenBSD: sigcode.S,v 1.9 2020/03/13 08:46:50 deraadt Exp $ */ /* $NetBSD: sigcode.S,v 1.6 2003/10/05 19:44:58 matt Exp $ */ /* @@ -57,10 +57,15 @@ sigcode: add r0, sp, #SIGF_SC mov r12, #SYS_sigreturn swi SYS_sigreturn + nop + nop .globl _C_LABEL(sigcoderet) _C_LABEL(sigcoderet): /* Well if that failed we better exit quick ! */ swi SYS_exit + nop + nop + .align 2 .global _C_LABEL(esigcode) _C_LABEL(esigcode): diff --git a/sys/arch/arm/arm/syscall.c b/sys/arch/arm/arm/syscall.c index 844f180b617..310aed4ab61 100644 --- a/sys/arch/arm/arm/syscall.c +++ b/sys/arch/arm/arm/syscall.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.c,v 1.20 2019/10/28 14:43:03 kettenis Exp $ */ +/* $OpenBSD: syscall.c,v 1.21 2020/03/13 08:46:50 deraadt Exp $ */ /* $NetBSD: syscall.c,v 1.24 2003/11/14 19:03:17 scw Exp $ */ /*- @@ -113,6 +113,9 @@ swi_handler(trapframe_t *frame) p->p_addr->u_pcb.pcb_tf = frame; + /* Skip over speculation-blocking barrier. */ + frame->tf_pc += 8; + code = frame->tf_r12; ap = &frame->tf_r0; @@ -164,7 +167,7 @@ swi_handler(trapframe_t *frame) /* * Reconstruct the pc to point at the swi. */ - frame->tf_pc -= INSN_SIZE; + frame->tf_pc -= 12; break; case EJUSTRETURN: |