aboutsummaryrefslogtreecommitdiff
path: root/arch/powerpc/include/asm/ftrace.h
diff options
context:
space:
mode:
authorChristophe Leroy <[email protected]>2022-02-15 19:31:24 +0100
committerMichael Ellerman <[email protected]>2022-02-16 23:09:47 +1100
commitfc75f87337983229b7355d6b77f30fb6e7f359ee (patch)
tree32347525d29a13a6f59063034c8236c47319aac5 /arch/powerpc/include/asm/ftrace.h
parentdf45a55788286c541449d82ee09fef3ac5ff77a1 (diff)
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: 40b035efe288 ("powerpc/ftrace: Implement CONFIG_DYNAMIC_FTRACE_WITH_ARGS") Reported-by: Naveen N. Rao <[email protected]> Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/2f9a7e898c93cc7438ef5ccd47cb9c3a9c5b53ef.1644949750.git.christophe.leroy@csgroup.eu
Diffstat (limited to 'arch/powerpc/include/asm/ftrace.h')
-rw-r--r--arch/powerpc/include/asm/ftrace.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h
index 70b457097098..ff034ae4e472 100644
--- a/arch/powerpc/include/asm/ftrace.h
+++ b/arch/powerpc/include/asm/ftrace.h
@@ -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,