Commit 983df5f2 authored by Sami Tolvanen's avatar Sami Tolvanen Committed by Steven Rostedt (VMware)

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: 9d907f1a ("ftrace/samples: Add a sample module that implements modify_ftrace_direct()")
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarSami Tolvanen <samitolvanen@google.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 8785f51a
...@@ -21,6 +21,7 @@ static unsigned long my_ip = (unsigned long)schedule; ...@@ -21,6 +21,7 @@ static unsigned long my_ip = (unsigned long)schedule;
asm ( asm (
" .pushsection .text, \"ax\", @progbits\n" " .pushsection .text, \"ax\", @progbits\n"
" .type my_tramp1, @function\n" " .type my_tramp1, @function\n"
" .globl my_tramp1\n"
" my_tramp1:" " my_tramp1:"
" pushq %rbp\n" " pushq %rbp\n"
" movq %rsp, %rbp\n" " movq %rsp, %rbp\n"
...@@ -29,6 +30,7 @@ asm ( ...@@ -29,6 +30,7 @@ asm (
" .size my_tramp1, .-my_tramp1\n" " .size my_tramp1, .-my_tramp1\n"
" ret\n" " ret\n"
" .type my_tramp2, @function\n" " .type my_tramp2, @function\n"
" .globl my_tramp2\n"
" my_tramp2:" " my_tramp2:"
" pushq %rbp\n" " pushq %rbp\n"
" movq %rsp, %rbp\n" " movq %rsp, %rbp\n"
......
...@@ -16,6 +16,7 @@ extern void my_tramp(void *); ...@@ -16,6 +16,7 @@ extern void my_tramp(void *);
asm ( asm (
" .pushsection .text, \"ax\", @progbits\n" " .pushsection .text, \"ax\", @progbits\n"
" .type my_tramp, @function\n" " .type my_tramp, @function\n"
" .globl my_tramp\n"
" my_tramp:" " my_tramp:"
" pushq %rbp\n" " pushq %rbp\n"
" movq %rsp, %rbp\n" " movq %rsp, %rbp\n"
......
...@@ -14,6 +14,7 @@ extern void my_tramp(void *); ...@@ -14,6 +14,7 @@ extern void my_tramp(void *);
asm ( asm (
" .pushsection .text, \"ax\", @progbits\n" " .pushsection .text, \"ax\", @progbits\n"
" .type my_tramp, @function\n" " .type my_tramp, @function\n"
" .globl my_tramp\n"
" my_tramp:" " my_tramp:"
" pushq %rbp\n" " pushq %rbp\n"
" movq %rsp, %rbp\n" " movq %rsp, %rbp\n"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment