1 |
From 983df5f2699f83f78643b19d3399b160d1e64f5b Mon Sep 17 00:00:00 2001 |
2 |
From: Sami Tolvanen <samitolvanen@google.com> |
3 |
Date: Fri, 13 Nov 2020 10:34:14 -0800 |
4 |
Subject: [PATCH 140/150] samples/ftrace: Mark my_tramp[12]? global |
5 |
|
6 |
my_tramp[12]? are declared as global functions in C, but they are not |
7 |
marked global in the inline assembly definition. This mismatch confuses |
8 |
Clang's Control-Flow Integrity checking. Fix the definitions by adding |
9 |
.globl. |
10 |
|
11 |
Link: https://lkml.kernel.org/r/20201113183414.1446671-1-samitolvanen@google.com |
12 |
|
13 |
Fixes: 9d907f1ae80b8 ("ftrace/samples: Add a sample module that implements modify_ftrace_direct()") |
14 |
Reviewed-by: Kees Cook <keescook@chromium.org> |
15 |
Signed-off-by: Sami Tolvanen <samitolvanen@google.com> |
16 |
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> |
17 |
--- |
18 |
samples/ftrace/ftrace-direct-modify.c | 2 ++ |
19 |
samples/ftrace/ftrace-direct-too.c | 1 + |
20 |
samples/ftrace/ftrace-direct.c | 1 + |
21 |
3 files changed, 4 insertions(+) |
22 |
|
23 |
diff --git a/samples/ftrace/ftrace-direct-modify.c b/samples/ftrace/ftrace-direct-modify.c |
24 |
index c13a5bc5095b..5b9a09957c6e 100644 |
25 |
--- a/samples/ftrace/ftrace-direct-modify.c |
26 |
+++ b/samples/ftrace/ftrace-direct-modify.c |
27 |
@@ -21,6 +21,7 @@ static unsigned long my_ip = (unsigned long)schedule; |
28 |
asm ( |
29 |
" .pushsection .text, \"ax\", @progbits\n" |
30 |
" .type my_tramp1, @function\n" |
31 |
+" .globl my_tramp1\n" |
32 |
" my_tramp1:" |
33 |
" pushq %rbp\n" |
34 |
" movq %rsp, %rbp\n" |
35 |
@@ -29,6 +30,7 @@ asm ( |
36 |
" .size my_tramp1, .-my_tramp1\n" |
37 |
" ret\n" |
38 |
" .type my_tramp2, @function\n" |
39 |
+" .globl my_tramp2\n" |
40 |
" my_tramp2:" |
41 |
" pushq %rbp\n" |
42 |
" movq %rsp, %rbp\n" |
43 |
diff --git a/samples/ftrace/ftrace-direct-too.c b/samples/ftrace/ftrace-direct-too.c |
44 |
index d5c5022be664..3f0079c9bd6f 100644 |
45 |
--- a/samples/ftrace/ftrace-direct-too.c |
46 |
+++ b/samples/ftrace/ftrace-direct-too.c |
47 |
@@ -16,6 +16,7 @@ extern void my_tramp(void *); |
48 |
asm ( |
49 |
" .pushsection .text, \"ax\", @progbits\n" |
50 |
" .type my_tramp, @function\n" |
51 |
+" .globl my_tramp\n" |
52 |
" my_tramp:" |
53 |
" pushq %rbp\n" |
54 |
" movq %rsp, %rbp\n" |
55 |
diff --git a/samples/ftrace/ftrace-direct.c b/samples/ftrace/ftrace-direct.c |
56 |
index 63ca06d42c80..a2729d1ef17f 100644 |
57 |
--- a/samples/ftrace/ftrace-direct.c |
58 |
+++ b/samples/ftrace/ftrace-direct.c |
59 |
@@ -14,6 +14,7 @@ extern void my_tramp(void *); |
60 |
asm ( |
61 |
" .pushsection .text, \"ax\", @progbits\n" |
62 |
" .type my_tramp, @function\n" |
63 |
+" .globl my_tramp\n" |
64 |
" my_tramp:" |
65 |
" pushq %rbp\n" |
66 |
" movq %rsp, %rbp\n" |
67 |
-- |
68 |
2.29.2 |
69 |
|