Add speculation-blocking sequence after syscalls like we did for libc a while
authorkettenis <kettenis@openbsd.org>
Mon, 28 Jun 2021 18:21:08 +0000 (18:21 +0000)
committerkettenis <kettenis@openbsd.org>
Mon, 28 Jun 2021 18:21:08 +0000 (18:21 +0000)
ago.  While there, fix the SYS_exit syscall.  The syscall number is passed in
r12, not as the argument of the syscall instruction.

ok deraadt@

sys/arch/arm/arm/sigcode.S

index ee53fcf..4e00395 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: sigcode.S,v 1.10 2020/10/19 17:57:40 naddy Exp $      */
+/*     $OpenBSD: sigcode.S,v 1.11 2021/06/28 18:21:08 kettenis Exp $   */
 /*     $NetBSD: sigcode.S,v 1.6 2003/10/05 19:44:58 matt Exp $ */
 
 /*
@@ -56,17 +56,16 @@ sigcode:
 /*     mov     r0, sp */
        add     r0, sp, #SIGF_SC
        mov     r12, #SYS_sigreturn
-       swi     SYS_sigreturn
-       nop
-       nop
+       swi     0
+       dsb     nsh
+       isb
        .globl  _C_LABEL(sigcoderet)
 _C_LABEL(sigcoderet):
        /* Well if that failed we better exit quick ! */
-       swi     SYS_exit
-       nop
-       nop
-
-       .align  2
+       mov     r12, #SYS_exit
+       swi     0
+       dsb     nsh
+       isb
         .global _C_LABEL(esigcode)
 _C_LABEL(esigcode):