Skip to content

Commit 983df5f

Browse files
samitolvanenrostedt
authored andcommitted
samples/ftrace: Mark my_tramp[12]? global
my_tramp[12]? are declared as global functions in C, but they are not marked global in the inline assembly definition. This mismatch confuses Clang's Control-Flow Integrity checking. Fix the definitions by adding .globl. Link: https://lkml.kernel.org/r/20201113183414.1446671-1-samitolvanen@google.com Fixes: 9d907f1 ("ftrace/samples: Add a sample module that implements modify_ftrace_direct()") Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 8785f51 commit 983df5f

3 files changed

Lines changed: 4 additions & 0 deletions

File tree

samples/ftrace/ftrace-direct-modify.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ static unsigned long my_ip = (unsigned long)schedule;
2121
asm (
2222
" .pushsection .text, \"ax\", @progbits\n"
2323
" .type my_tramp1, @function\n"
24+
" .globl my_tramp1\n"
2425
" my_tramp1:"
2526
" pushq %rbp\n"
2627
" movq %rsp, %rbp\n"
@@ -29,6 +30,7 @@ asm (
2930
" .size my_tramp1, .-my_tramp1\n"
3031
" ret\n"
3132
" .type my_tramp2, @function\n"
33+
" .globl my_tramp2\n"
3234
" my_tramp2:"
3335
" pushq %rbp\n"
3436
" movq %rsp, %rbp\n"

samples/ftrace/ftrace-direct-too.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ extern void my_tramp(void *);
1616
asm (
1717
" .pushsection .text, \"ax\", @progbits\n"
1818
" .type my_tramp, @function\n"
19+
" .globl my_tramp\n"
1920
" my_tramp:"
2021
" pushq %rbp\n"
2122
" movq %rsp, %rbp\n"

samples/ftrace/ftrace-direct.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ extern void my_tramp(void *);
1414
asm (
1515
" .pushsection .text, \"ax\", @progbits\n"
1616
" .type my_tramp, @function\n"
17+
" .globl my_tramp\n"
1718
" my_tramp:"
1819
" pushq %rbp\n"
1920
" movq %rsp, %rbp\n"

0 commit comments

Comments
 (0)