Re: [GIT PULL] ftrace: Fixes for v6.13

From: Al Viro
Date: Sat Dec 14 2024 - 23:48:57 EST


On Sat, Dec 14, 2024 at 06:21:38PM -0500, Steven Rostedt wrote:

> The real fix would be to have microblaze implement the kernel_stack_pointer()
> function. For now, just make microblaze use the old logic which prints the
> function graph trampoline in the function tracer.

Correction: kernel_stack_pointer() implementation there would make it _compile_,
but it wouldn't work right.

What it needs is ftrace_regs_get_stack_pointer() *and* HAVE_ARCH_FTRACE_REGS
defined to suppress the use of defaults.

Background, one more time: kernel_stack_pointer() would give you the kernel
stack pointer by struct pt_regs (if that is possible in the first place).
ftrace_regs_get_stack_pointer() gives the kernel stack pointer by whatever
object _mcount() has set up. *IF* that object is identical to struct pt_regs
and kernel_stack_pointer() exists, you could cast the pointer to a struct pt_regs *
value and feed that to kernel_stack_pointer(). For microblaze _mcount-created
object is *NOT* the same thing as struct pt_regs, so the default would've done
you no good even if kernel_stack_pointer() existed on microblaze.

See arch/microblaze/kernel/mcount.S SAVE_REGS and compare with their
definition of struct pt_regs in arch/microblaze/include/uapi/asm/ptrace.h

IOW, immediate fix is right, but the long-term fix suggested in pull request
is not.