diff options
author | mortimer <mortimer@cvs.openbsd.org> | 2018-08-12 17:15:11 +0000 |
---|---|---|
committer | mortimer <mortimer@cvs.openbsd.org> | 2018-08-12 17:15:11 +0000 |
commit | b85ad2a620f0bc4f120a23c38a930fd7e6029982 (patch) | |
tree | 159b0a21bfa0b590c5abc78d076fa49507c321ff /lib/libc/arch/aarch64 | |
parent | 4ff0182a70e6c36d92ab5b2472ad57f18792f7b5 (diff) |
Add retguard macros for arm64 asm and apply them in the straightforward
cases in kernel and libc.
ok deraadt@
Diffstat (limited to 'lib/libc/arch/aarch64')
-rw-r--r-- | lib/libc/arch/aarch64/gen/byte_swap_2.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/aarch64/gen/byte_swap_4.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/aarch64/sys/Ovfork.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/aarch64/sys/brk.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/aarch64/sys/cerror.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/aarch64/sys/sbrk.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/aarch64/sys/sigpending.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/aarch64/sys/sigprocmask.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/aarch64/sys/sigsuspend.S | 4 | ||||
-rw-r--r-- | lib/libc/arch/aarch64/sys/tfork_thread.S | 4 |
10 files changed, 30 insertions, 10 deletions
diff --git a/lib/libc/arch/aarch64/gen/byte_swap_2.S b/lib/libc/arch/aarch64/gen/byte_swap_2.S index 5bd951ee8a4..76b7db58c5c 100644 --- a/lib/libc/arch/aarch64/gen/byte_swap_2.S +++ b/lib/libc/arch/aarch64/gen/byte_swap_2.S @@ -1,4 +1,4 @@ -/* $OpenBSD: byte_swap_2.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */ +/* $OpenBSD: byte_swap_2.S,v 1.2 2018/08/12 17:15:10 mortimer Exp $ */ /* $NetBSD: byte_swap_2.S,v 1.3 2003/04/05 23:08:51 bjh21 Exp $ */ /*- @@ -36,7 +36,9 @@ _ENTRY(_C_LABEL(__bswap16)) _ENTRY(_C_LABEL(ntohs)) _ENTRY(_C_LABEL(htons)) _PROF_PROLOGUE + RETGUARD_SETUP(__bswap16, x15) and w8, w0, #0xffff ubfx w0, w0, #8, #8 bfi w0, w8, #8, #16 + RETGUARD_CHECK(__bswap16, x15) ret diff --git a/lib/libc/arch/aarch64/gen/byte_swap_4.S b/lib/libc/arch/aarch64/gen/byte_swap_4.S index 6d9119b2230..dfc3db40d29 100644 --- a/lib/libc/arch/aarch64/gen/byte_swap_4.S +++ b/lib/libc/arch/aarch64/gen/byte_swap_4.S @@ -1,4 +1,4 @@ -/* $OpenBSD: byte_swap_4.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */ +/* $OpenBSD: byte_swap_4.S,v 1.2 2018/08/12 17:15:10 mortimer Exp $ */ /* $NetBSD: byte_swap_4.S,v 1.2 2003/04/05 23:08:51 bjh21 Exp $ */ /*- @@ -36,5 +36,7 @@ _ENTRY(_C_LABEL(__bswap32)) _ENTRY(_C_LABEL(ntohl)) _ENTRY(_C_LABEL(htonl)) _PROF_PROLOGUE + RETGUARD_SETUP(__bswap32, x15) rev w0, w0 + RETGUARD_CHECK(__bswap32, x15) ret diff --git a/lib/libc/arch/aarch64/sys/Ovfork.S b/lib/libc/arch/aarch64/sys/Ovfork.S index 3dd82683ac7..db40fb8b118 100644 --- a/lib/libc/arch/aarch64/sys/Ovfork.S +++ b/lib/libc/arch/aarch64/sys/Ovfork.S @@ -1,4 +1,4 @@ -/* $OpenBSD: Ovfork.S,v 1.3 2017/11/22 20:36:02 kettenis Exp $ */ +/* $OpenBSD: Ovfork.S,v 1.4 2018/08/12 17:15:10 mortimer Exp $ */ /* $NetBSD: Ovfork.S,v 1.6 2003/08/07 16:42:03 agc Exp $ */ /*- @@ -35,9 +35,11 @@ #include "SYS.h" SYSENTRY_HIDDEN(vfork) + RETGUARD_SETUP(vfork, x15) mov x2, x30 SYSTRAP(vfork) bcs CERROR mov x30, x2 + RETGUARD_CHECK(vfork, x15) ret SYSCALL_END_HIDDEN(vfork) diff --git a/lib/libc/arch/aarch64/sys/brk.S b/lib/libc/arch/aarch64/sys/brk.S index af0e31de410..574c615afb9 100644 --- a/lib/libc/arch/aarch64/sys/brk.S +++ b/lib/libc/arch/aarch64/sys/brk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: brk.S,v 1.4 2017/11/22 20:36:02 kettenis Exp $ */ +/* $OpenBSD: brk.S,v 1.5 2018/08/12 17:15:10 mortimer Exp $ */ /* $NetBSD: brk.S,v 1.7 2003/12/26 11:23:44 martin Exp $ */ /*- @@ -48,6 +48,7 @@ __minbrk: * Change the data segment size */ ENTRY(brk) + RETGUARD_SETUP(brk, x15) #ifdef __PIC__ /* Setup the GOT */ adrp x3, :got:__minbrk @@ -81,6 +82,7 @@ ENTRY(brk) /* Return 0 for success */ mov x0, #0x00000000 + RETGUARD_CHECK(brk, x15) ret .align 3 diff --git a/lib/libc/arch/aarch64/sys/cerror.S b/lib/libc/arch/aarch64/sys/cerror.S index 4ef8359f63f..e12dcf44062 100644 --- a/lib/libc/arch/aarch64/sys/cerror.S +++ b/lib/libc/arch/aarch64/sys/cerror.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cerror.S,v 1.4 2017/03/19 00:29:02 guenther Exp $ */ +/* $OpenBSD: cerror.S,v 1.5 2018/08/12 17:15:10 mortimer Exp $ */ /*- * Copyright (c) 2014 Andrew Turner * All rights reserved. @@ -32,8 +32,10 @@ #define TCB_OFFSET_ERRNO (-12) _ENTRY(CERROR) + RETGUARD_SETUP(CERROR, x15) mrs x1, tpidr_el0 str w0, [x1, #TCB_OFFSET_ERRNO] movn x0, #0 + RETGUARD_CHECK(CERROR, x15) ret END(CERROR) diff --git a/lib/libc/arch/aarch64/sys/sbrk.S b/lib/libc/arch/aarch64/sys/sbrk.S index 75b25a73c57..1e3bd836832 100644 --- a/lib/libc/arch/aarch64/sys/sbrk.S +++ b/lib/libc/arch/aarch64/sys/sbrk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sbrk.S,v 1.3 2017/11/22 20:36:02 kettenis Exp $ */ +/* $OpenBSD: sbrk.S,v 1.4 2018/08/12 17:15:10 mortimer Exp $ */ /* $NetBSD: sbrk.S,v 1.7 2003/08/07 16:42:05 agc Exp $ */ /*- @@ -49,6 +49,7 @@ __curbrk: * Change the data segment size */ ENTRY(sbrk) + RETGUARD_SETUP(sbrk, x15) #ifdef __PIC__ /* Setup the GOT */ adrp x3, :got:__curbrk @@ -71,6 +72,7 @@ ENTRY(sbrk) str x1, [x2] /* Return old curbrk value */ + RETGUARD_CHECK(sbrk, x15) ret .align 3 diff --git a/lib/libc/arch/aarch64/sys/sigpending.S b/lib/libc/arch/aarch64/sys/sigpending.S index 076473b1ccb..c532274f79c 100644 --- a/lib/libc/arch/aarch64/sys/sigpending.S +++ b/lib/libc/arch/aarch64/sys/sigpending.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigpending.S,v 1.2 2017/02/23 22:50:07 patrick Exp $ */ +/* $OpenBSD: sigpending.S,v 1.3 2018/08/12 17:15:10 mortimer Exp $ */ /* $NetBSD: sigpending.S,v 1.5 2003/08/07 16:42:05 agc Exp $ */ /*- @@ -35,10 +35,12 @@ #include "SYS.h" SYSENTRY(sigpending) + RETGUARD_SETUP(sigpending, x15) mov x2, x0 SYSTRAP(sigpending) bcs CERROR str w0, [x2] mov x0, #0 + RETGUARD_CHECK(sigpending, x15) ret SYSCALL_END(sigpending) diff --git a/lib/libc/arch/aarch64/sys/sigprocmask.S b/lib/libc/arch/aarch64/sys/sigprocmask.S index 7a9ea688f14..a07ef23ae9f 100644 --- a/lib/libc/arch/aarch64/sys/sigprocmask.S +++ b/lib/libc/arch/aarch64/sys/sigprocmask.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigprocmask.S,v 1.2 2017/02/22 22:18:51 patrick Exp $ */ +/* $OpenBSD: sigprocmask.S,v 1.3 2018/08/12 17:15:10 mortimer Exp $ */ /* $NetBSD: sigprocmask.S,v 1.5 2003/08/07 16:42:05 agc Exp $ */ /*- @@ -35,6 +35,7 @@ #include "SYS.h" SYSENTRY_HIDDEN(sigprocmask) + RETGUARD_SETUP(sigprocmask, x15) cbz x1, 1f ldr w1, [x1] b 2f @@ -49,5 +50,6 @@ SYSENTRY_HIDDEN(sigprocmask) str w0, [x2] 1: mov x0, #0x00000000 + RETGUARD_CHECK(sigprocmask, x15) ret SYSCALL_END_HIDDEN(sigprocmask) diff --git a/lib/libc/arch/aarch64/sys/sigsuspend.S b/lib/libc/arch/aarch64/sys/sigsuspend.S index 9be04da1525..d28d0377af6 100644 --- a/lib/libc/arch/aarch64/sys/sigsuspend.S +++ b/lib/libc/arch/aarch64/sys/sigsuspend.S @@ -1,4 +1,4 @@ -/* $OpenBSD: sigsuspend.S,v 1.1 2017/01/11 18:09:24 patrick Exp $ */ +/* $OpenBSD: sigsuspend.S,v 1.2 2018/08/12 17:15:10 mortimer Exp $ */ /* $NetBSD: sigsuspend.S,v 1.6 2003/08/07 16:42:05 agc Exp $ */ /*- @@ -35,9 +35,11 @@ #include "SYS.h" SYSENTRY_HIDDEN(sigsuspend) + RETGUARD_SETUP(sigsuspend, x15) ldr w0, [x0] SYSTRAP(sigsuspend) bcs CERROR mov x0, #0 + RETGUARD_CHECK(sigsuspend, x15) ret SYSCALL_END_HIDDEN(sigsuspend) diff --git a/lib/libc/arch/aarch64/sys/tfork_thread.S b/lib/libc/arch/aarch64/sys/tfork_thread.S index 5dda781adc2..6e515c32b24 100644 --- a/lib/libc/arch/aarch64/sys/tfork_thread.S +++ b/lib/libc/arch/aarch64/sys/tfork_thread.S @@ -1,4 +1,4 @@ -/* $OpenBSD: tfork_thread.S,v 1.2 2017/02/20 08:42:46 patrick Exp $ */ +/* $OpenBSD: tfork_thread.S,v 1.3 2018/08/12 17:15:10 mortimer Exp $ */ /* * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> * @@ -24,11 +24,13 @@ */ ENTRY(__tfork_thread) + RETGUARD_SETUP(__tfork_thread, x15) SYSTRAP(__tfork) bcs CERROR /* check if we are parent or child */ cbz x0, 1f + RETGUARD_CHECK(__tfork_thread, x15) ret 1: |