powerpc/ftrace: Have arch_ftrace_get_regs() return NULL unless FL_SAVE_REGS is set
When FL_SAVE_REGS is not set we get here via ftrace_caller()
which doesn't save all registers.
ftrace_caller() explicitely clears regs.msr, so we can rely
on it to know where we come from. We don't expect MSR register
to be 0 at all when involving ftrace.
Fixes: 40b035efe2
("powerpc/ftrace: Implement CONFIG_DYNAMIC_FTRACE_WITH_ARGS")
Reported-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/2f9a7e898c93cc7438ef5ccd47cb9c3a9c5b53ef.1644949750.git.christophe.leroy@csgroup.eu
This commit is contained in:
parent
df45a55788
commit
fc75f87337
|
@ -30,7 +30,8 @@ struct ftrace_regs {
|
|||
|
||||
static __always_inline struct pt_regs *arch_ftrace_get_regs(struct ftrace_regs *fregs)
|
||||
{
|
||||
return &fregs->regs;
|
||||
/* We clear regs.msr in ftrace_call */
|
||||
return fregs->regs.msr ? &fregs->regs : NULL;
|
||||
}
|
||||
|
||||
static __always_inline void ftrace_instruction_pointer_set(struct ftrace_regs *fregs,
|
||||
|
|
|
@ -205,6 +205,10 @@ _GLOBAL(ftrace_caller)
|
|||
PPC_STL r0, _LINK(r1)
|
||||
mr r4, r0
|
||||
|
||||
/* Clear MSR to flag as ftrace_caller versus frace_regs_caller */
|
||||
li r8, 0
|
||||
PPC_STL r8, _MSR(r1)
|
||||
|
||||
/* Load &pt_regs in r6 for call below */
|
||||
addi r6, r1 ,STACK_FRAME_OVERHEAD
|
||||
|
||||
|
|
Loading…
Reference in New Issue