x86/ibt,ftrace: Add ENDBR to samples/ftrace
authorPeter Zijlstra <peterz@infradead.org>
Tue, 8 Mar 2022 15:30:34 +0000 (16:30 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 15 Mar 2022 09:32:38 +0000 (10:32 +0100)
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/20220308154318.523421433@infradead.org
samples/ftrace/ftrace-direct-modify.c
samples/ftrace/ftrace-direct-multi-modify.c
samples/ftrace/ftrace-direct-multi.c
samples/ftrace/ftrace-direct-too.c
samples/ftrace/ftrace-direct.c

index 2c7c31893551dda8c9b06573a55221c315d59712..39146fa83e20b3f0c4dc41b4098b7bdf524a3a08 100644 (file)
@@ -24,20 +24,25 @@ static unsigned long my_ip = (unsigned long)schedule;
 
 #ifdef CONFIG_X86_64
 
+#include <asm/ibt.h>
+
 asm (
 "      .pushsection    .text, \"ax\", @progbits\n"
 "      .type           my_tramp1, @function\n"
 "      .globl          my_tramp1\n"
 "   my_tramp1:"
+       ASM_ENDBR
 "      pushq %rbp\n"
 "      movq %rsp, %rbp\n"
 "      call my_direct_func1\n"
 "      leave\n"
 "      .size           my_tramp1, .-my_tramp1\n"
        ASM_RET
+
 "      .type           my_tramp2, @function\n"
 "      .globl          my_tramp2\n"
 "   my_tramp2:"
+       ASM_ENDBR
 "      pushq %rbp\n"
 "      movq %rsp, %rbp\n"
 "      call my_direct_func2\n"
index 6f43a39decd02d25be90f2a30aeebd682f6b8521..65aa94d96f4e313215d22048b61678fef126fa0e 100644 (file)
@@ -22,11 +22,14 @@ extern void my_tramp2(void *);
 
 #ifdef CONFIG_X86_64
 
+#include <asm/ibt.h>
+
 asm (
 "      .pushsection    .text, \"ax\", @progbits\n"
 "      .type           my_tramp1, @function\n"
 "      .globl          my_tramp1\n"
 "   my_tramp1:"
+       ASM_ENDBR
 "      pushq %rbp\n"
 "      movq %rsp, %rbp\n"
 "      pushq %rdi\n"
@@ -34,12 +37,13 @@ asm (
 "      call my_direct_func1\n"
 "      popq %rdi\n"
 "      leave\n"
-"      ret\n"
+       ASM_RET
 "      .size           my_tramp1, .-my_tramp1\n"
+
 "      .type           my_tramp2, @function\n"
-"\n"
 "      .globl          my_tramp2\n"
 "   my_tramp2:"
+       ASM_ENDBR
 "      pushq %rbp\n"
 "      movq %rsp, %rbp\n"
 "      pushq %rdi\n"
@@ -47,7 +51,7 @@ asm (
 "      call my_direct_func2\n"
 "      popq %rdi\n"
 "      leave\n"
-"      ret\n"
+       ASM_RET
 "      .size           my_tramp2, .-my_tramp2\n"
 "      .popsection\n"
 );
index 2fafc9afcbf0fcf31df7eaebd8fd0c19fa44fd28..41ded7c615c7feee91b6d2597a51c24f8e2d1b68 100644 (file)
@@ -17,11 +17,14 @@ extern void my_tramp(void *);
 
 #ifdef CONFIG_X86_64
 
+#include <asm/ibt.h>
+
 asm (
 "      .pushsection    .text, \"ax\", @progbits\n"
 "      .type           my_tramp, @function\n"
 "      .globl          my_tramp\n"
 "   my_tramp:"
+       ASM_ENDBR
 "      pushq %rbp\n"
 "      movq %rsp, %rbp\n"
 "      pushq %rdi\n"
@@ -29,7 +32,7 @@ asm (
 "      call my_direct_func\n"
 "      popq %rdi\n"
 "      leave\n"
-"      ret\n"
+       ASM_RET
 "      .size           my_tramp, .-my_tramp\n"
 "      .popsection\n"
 );
index c93fb0e951738aac0e1301c89c5522a19b2c766f..6690468c5cc2d5be4ba1a70fc87f03fa77ef0078 100644 (file)
@@ -19,11 +19,14 @@ extern void my_tramp(void *);
 
 #ifdef CONFIG_X86_64
 
+#include <asm/ibt.h>
+
 asm (
 "      .pushsection    .text, \"ax\", @progbits\n"
 "      .type           my_tramp, @function\n"
 "      .globl          my_tramp\n"
 "   my_tramp:"
+       ASM_ENDBR
 "      pushq %rbp\n"
 "      movq %rsp, %rbp\n"
 "      pushq %rdi\n"
index 8b551e503a48e310183ac9cfa5f94f4cc6dd9d1b..e8f1e440b9b8a06b36e17f513c6b16673f2b5604 100644 (file)
@@ -16,11 +16,14 @@ extern void my_tramp(void *);
 
 #ifdef CONFIG_X86_64
 
+#include <asm/ibt.h>
+
 asm (
 "      .pushsection    .text, \"ax\", @progbits\n"
 "      .type           my_tramp, @function\n"
 "      .globl          my_tramp\n"
 "   my_tramp:"
+       ASM_ENDBR
 "      pushq %rbp\n"
 "      movq %rsp, %rbp\n"
 "      pushq %rdi\n"