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 77 * /
88
99#include <linux/linkage.h>
10+ #include <linux/cfi_types.h>
1011#include <asm/asm - offsets.h>
1112#include <asm/assembler.h>
1213#include <asm/ftrace.h>
@@ -294,10 +295,14 @@ SYM_FUNC_END(ftrace_graph_caller)
294295#endif / * CONFIG_FUNCTION_GRAPH_TRACER * /
295296#endif / * CONFIG_DYNAMIC_FTRACE_WITH_REGS * /
296297
297- SYM_FUNC_START (ftrace_stub)
298+ SYM_TYPED_FUNC_START (ftrace_stub)
298299 ret
299300SYM_FUNC_END(ftrace_stub)
300301
302+ SYM_TYPED_FUNC_START(ftrace_stub_graph)
303+ ret
304+ SYM_FUNC_END(ftrace_stub_graph)
305+
301306#ifdef CONFIG_FUNCTION_GRAPH_TRACER
302307/ *
303308 * void return_to_handler(void)
Original file line number Diff line number Diff line change 44 */
55
66#include <linux/linkage.h>
7+ #include <linux/cfi_types.h>
78#include <asm/ptrace.h>
89#include <asm/ftrace.h>
910#include <asm/export.h>
129130
130131 .endm
131132
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+
132141#ifdef CONFIG_DYNAMIC_FTRACE
133142
134143SYM_FUNC_START(__fentry__)
@@ -176,11 +185,6 @@ SYM_INNER_LABEL(ftrace_caller_end, SYM_L_GLOBAL)
176185SYM_FUNC_END(ftrace_caller);
177186STACK_FRAME_NON_STANDARD_FP(ftrace_caller)
178187
179- SYM_FUNC_START(ftrace_stub)
180- UNWIND_HINT_FUNC
181- RET
182- SYM_FUNC_END(ftrace_stub)
183-
184188SYM_FUNC_START(ftrace_regs_caller)
185189 /* Save the current flags before any operations that can change them */
186190 pushfq
@@ -282,9 +286,6 @@ STACK_FRAME_NON_STANDARD_FP(ftrace_regs_caller)
282286SYM_FUNC_START(__fentry__)
283287 cmpq $ftrace_stub, ftrace_trace_function
284288 jnz trace
285-
286- SYM_INNER_LABEL(ftrace_stub, SYM_L_GLOBAL)
287- ENDBR
288289 RET
289290
290291trace:
Original file line number Diff line number Diff line change 162162#define PATCHABLE_DISCARDS *(__patchable_function_entries)
163163#endif
164164
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+
165175#ifdef CONFIG_FTRACE_MCOUNT_RECORD
166176/*
167177 * The ftrace call sites are logged to a section whose name depends on the
168178 * compiler option used. A given kernel image will only use one, AKA
169179 * FTRACE_CALLSITE_SECTION. We capture all of them here to avoid header
170180 * dependencies for FTRACE_CALLSITE_SECTION's definition.
171181 *
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- *
176182 * ftrace_ops_list_func will be defined as arch_ftrace_ops_list_func
177183 * as some archs will have a different prototype for that function
178184 * but ftrace_ops_list_func() will have a single prototype.
182188 KEEP(*(__mcount_loc)) \
183189 KEEP_PATCHABLE \
184190 __stop_mcount_loc = .; \
185- ftrace_stub_graph = ftrace_stub; \
191+ FTRACE_STUB_HACK \
186192 ftrace_ops_list_func = arch_ftrace_ops_list_func;
187193#else
188194# ifdef CONFIG_FUNCTION_TRACER
189- # define MCOUNT_REC () ftrace_stub_graph = ftrace_stub; \
195+ # define MCOUNT_REC () FTRACE_STUB_HACK \
190196 ftrace_ops_list_func = arch_ftrace_ops_list_func;
191197# else
192198# define MCOUNT_REC ()
You can’t perform that action at this time.
0 commit comments