Skip to content

Commit b5f1fc3

Browse files
author
Peter Zijlstra
committed
x86/ftrace: Remove ftrace_epilogue()
Remove the weird jumps to RET and simply use RET. This then promotes ftrace_stub() to a real function; which becomes important for kcfi. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Peter Zijlstra <[email protected]>
1 parent 67bf649 commit b5f1fc3

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

arch/x86/kernel/ftrace_64.S

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,14 @@ SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
172172
*/
173173
SYM_INNER_LABEL(ftrace_caller_end, SYM_L_GLOBAL)
174174
ANNOTATE_NOENDBR
175-
176-
jmp ftrace_epilogue
175+
RET
177176
SYM_FUNC_END(ftrace_caller);
178177
STACK_FRAME_NON_STANDARD_FP(ftrace_caller)
179178

180-
SYM_FUNC_START(ftrace_epilogue)
181-
/*
182-
* This is weak to keep gas from relaxing the jumps.
183-
*/
184-
SYM_INNER_LABEL_ALIGN(ftrace_stub, SYM_L_WEAK)
179+
SYM_FUNC_START(ftrace_stub)
185180
UNWIND_HINT_FUNC
186-
ENDBR
187181
RET
188-
SYM_FUNC_END(ftrace_epilogue)
182+
SYM_FUNC_END(ftrace_stub)
189183

190184
SYM_FUNC_START(ftrace_regs_caller)
191185
/* Save the current flags before any operations that can change them */
@@ -262,14 +256,11 @@ SYM_INNER_LABEL(ftrace_regs_caller_jmp, SYM_L_GLOBAL)
262256
popfq
263257

264258
/*
265-
* As this jmp to ftrace_epilogue can be a short jump
266-
* it must not be copied into the trampoline.
267-
* The trampoline will add the code to jump
268-
* to the return.
259+
* The trampoline will add the return.
269260
*/
270261
SYM_INNER_LABEL(ftrace_regs_caller_end, SYM_L_GLOBAL)
271262
ANNOTATE_NOENDBR
272-
jmp ftrace_epilogue
263+
RET
273264

274265
/* Swap the flags with orig_rax */
275266
1: movq MCOUNT_REG_SIZE(%rsp), %rdi
@@ -280,7 +271,7 @@ SYM_INNER_LABEL(ftrace_regs_caller_end, SYM_L_GLOBAL)
280271
/* Restore flags */
281272
popfq
282273
UNWIND_HINT_FUNC
283-
jmp ftrace_epilogue
274+
RET
284275

285276
SYM_FUNC_END(ftrace_regs_caller)
286277
STACK_FRAME_NON_STANDARD_FP(ftrace_regs_caller)

0 commit comments

Comments
 (0)