x86/ftrace: Rebalance RSB
ftrace_regs_caller() uses a PUSH;RET pattern to tail-call into a direct-call function, this unbalances the RSB, fix that. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20220915111148.823216933@infradead.org
This commit is contained in:
parent
eac828eaef
commit
36b64f1012
1 changed files with 11 additions and 0 deletions
|
@ -271,6 +271,17 @@ SYM_INNER_LABEL(ftrace_regs_caller_end, SYM_L_GLOBAL)
|
||||||
/* Restore flags */
|
/* Restore flags */
|
||||||
popfq
|
popfq
|
||||||
UNWIND_HINT_FUNC
|
UNWIND_HINT_FUNC
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The above left an extra return value on the stack; effectively
|
||||||
|
* doing a tail-call without using a register. This PUSH;RET
|
||||||
|
* pattern unbalances the RSB, inject a pointless CALL to rebalance.
|
||||||
|
*/
|
||||||
|
ANNOTATE_INTRA_FUNCTION_CALL
|
||||||
|
CALL .Ldo_rebalance
|
||||||
|
int3
|
||||||
|
.Ldo_rebalance:
|
||||||
|
add $8, %rsp
|
||||||
RET
|
RET
|
||||||
|
|
||||||
SYM_FUNC_END(ftrace_regs_caller)
|
SYM_FUNC_END(ftrace_regs_caller)
|
||||||
|
|
Loading…
Add table
Reference in a new issue