File tree Expand file tree Collapse file tree 3 files changed +27
-15
lines changed Expand file tree Collapse file tree 3 files changed +27
-15
lines changed Original file line number Diff line number Diff line change 7
7
* /
8
8
9
9
#include <linux/linkage.h>
10
+ #include <linux/cfi_types.h>
10
11
#include <asm/asm - offsets.h>
11
12
#include <asm/assembler.h>
12
13
#include <asm/ftrace.h>
@@ -294,10 +295,14 @@ SYM_FUNC_END(ftrace_graph_caller)
294
295
#endif / * CONFIG_FUNCTION_GRAPH_TRACER * /
295
296
#endif / * CONFIG_DYNAMIC_FTRACE_WITH_REGS * /
296
297
297
- SYM_FUNC_START (ftrace_stub)
298
+ SYM_TYPED_FUNC_START (ftrace_stub)
298
299
ret
299
300
SYM_FUNC_END(ftrace_stub)
300
301
302
+ SYM_TYPED_FUNC_START(ftrace_stub_graph)
303
+ ret
304
+ SYM_FUNC_END(ftrace_stub_graph)
305
+
301
306
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
302
307
/ *
303
308
* void return_to_handler(void)
Original file line number Diff line number Diff line change 4
4
*/
5
5
6
6
#include <linux/linkage.h>
7
+ #include <linux/cfi_types.h>
7
8
#include <asm/ptrace.h>
8
9
#include <asm/ftrace.h>
9
10
#include <asm/export.h>
129
130
130
131
.endm
131
132
133
+ SYM_TYPED_FUNC_START(ftrace_stub)
134
+ RET
135
+ SYM_FUNC_END(ftrace_stub)
136
+
137
+ SYM_TYPED_FUNC_START(ftrace_stub_graph)
138
+ RET
139
+ SYM_FUNC_END(ftrace_stub_graph)
140
+
132
141
#ifdef CONFIG_DYNAMIC_FTRACE
133
142
134
143
SYM_FUNC_START(__fentry__)
@@ -176,11 +185,6 @@ SYM_INNER_LABEL(ftrace_caller_end, SYM_L_GLOBAL)
176
185
SYM_FUNC_END(ftrace_caller);
177
186
STACK_FRAME_NON_STANDARD_FP(ftrace_caller)
178
187
179
- SYM_FUNC_START(ftrace_stub)
180
- UNWIND_HINT_FUNC
181
- RET
182
- SYM_FUNC_END(ftrace_stub)
183
-
184
188
SYM_FUNC_START(ftrace_regs_caller)
185
189
/* Save the current flags before any operations that can change them */
186
190
pushfq
@@ -282,9 +286,6 @@ STACK_FRAME_NON_STANDARD_FP(ftrace_regs_caller)
282
286
SYM_FUNC_START(__fentry__)
283
287
cmpq $ftrace_stub, ftrace_trace_function
284
288
jnz trace
285
-
286
- SYM_INNER_LABEL(ftrace_stub, SYM_L_GLOBAL)
287
- ENDBR
288
289
RET
289
290
290
291
trace:
Original file line number Diff line number Diff line change 162
162
#define PATCHABLE_DISCARDS *(__patchable_function_entries)
163
163
#endif
164
164
165
+ #ifndef CONFIG_ARCH_SUPPORTS_CFI_CLANG
166
+ /*
167
+ * Simply points to ftrace_stub, but with the proper protocol.
168
+ * Defined by the linker script in linux/vmlinux.lds.h
169
+ */
170
+ #define FTRACE_STUB_HACK ftrace_stub_graph = ftrace_stub;
171
+ #else
172
+ #define FTRACE_STUB_HACK
173
+ #endif
174
+
165
175
#ifdef CONFIG_FTRACE_MCOUNT_RECORD
166
176
/*
167
177
* The ftrace call sites are logged to a section whose name depends on the
168
178
* compiler option used. A given kernel image will only use one, AKA
169
179
* FTRACE_CALLSITE_SECTION. We capture all of them here to avoid header
170
180
* dependencies for FTRACE_CALLSITE_SECTION's definition.
171
181
*
172
- * Need to also make ftrace_stub_graph point to ftrace_stub
173
- * so that the same stub location may have different protocols
174
- * and not mess up with C verifiers.
175
- *
176
182
* ftrace_ops_list_func will be defined as arch_ftrace_ops_list_func
177
183
* as some archs will have a different prototype for that function
178
184
* but ftrace_ops_list_func() will have a single prototype.
182
188
KEEP(*(__mcount_loc)) \
183
189
KEEP_PATCHABLE \
184
190
__stop_mcount_loc = .; \
185
- ftrace_stub_graph = ftrace_stub; \
191
+ FTRACE_STUB_HACK \
186
192
ftrace_ops_list_func = arch_ftrace_ops_list_func;
187
193
#else
188
194
# ifdef CONFIG_FUNCTION_TRACER
189
- # define MCOUNT_REC () ftrace_stub_graph = ftrace_stub; \
195
+ # define MCOUNT_REC () FTRACE_STUB_HACK \
190
196
ftrace_ops_list_func = arch_ftrace_ops_list_func;
191
197
# else
192
198
# define MCOUNT_REC ()
You can’t perform that action at this time.
0 commit comments