Add "bti c" where needed for BTI control flow integrety checks.
authorkettenis <kettenis@openbsd.org>
Fri, 31 Mar 2023 18:46:24 +0000 (18:46 +0000)
committerkettenis <kettenis@openbsd.org>
Fri, 31 Mar 2023 18:46:24 +0000 (18:46 +0000)
ok deraadt@

lib/csu/aarch64/md_init.h

index c8420ca..71356c6 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: md_init.h,v 1.10 2020/10/19 17:57:40 naddy Exp $ */
+/* $OpenBSD: md_init.h,v 1.11 2023/03/31 18:46:24 kettenis Exp $ */
 
 /*-
  * Copyright (c) 2001 Ross Harvey
@@ -45,6 +45,7 @@
        "       .type " #entry_pt ",%function   \n" \
        "       .align 4                        \n" \
        #entry_pt":                             \n" \
+       "       bti     c                       \n" \
        "       sub     sp, sp, #16             \n" \
        "       str     lr, [sp]                \n" \
        "       /* fall thru */                 \n" \
@@ -68,6 +69,7 @@
        "       .globl  __start                 \n" \
        "_start:                                \n" \
        "__start:                               \n" \
+       "       bti     c                       \n" \
        "       mov     x3, x2  /* cleanup */   \n" \
        "/* Get argc/argv/envp from stack */    \n" \
        "       ldr     x0, [sp]                \n" \