Re: ARM Ftrace Function Graph Fails With UNWINDER_FRAME_POINTER
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
Date: 2023-12-01 18:23:46
Also in:
linux-arm-kernel
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
Date: 2023-12-01 18:23:46
Also in:
linux-arm-kernel
On Fri, Dec 01, 2023 at 10:12:48AM +0100, Ard Biesheuvel wrote:
It appears the sub instruction at 0x6dd0 correctly accounts for the extra 8 bytes, so the frame pointer is valid. So it is our assumption that there are no gaps between the stack frames is invalid. Could you try the following change please?--- a/arch/arm/kernel/ftrace.c +++ b/arch/arm/kernel/ftrace.c@@ -235,8 +235,12 @@ return; if (IS_ENABLED(CONFIG_UNWINDER_FRAME_POINTER)) { - /* FP points one word below parent's top of stack */ - frame_pointer += 4; + /* + * The top of stack of the parent is recorded in the stack + * frame at offset [fp, #-8]. + */ + get_kernel_nofault(frame_pointer, + (unsigned long *)(frame_pointer - 8));
Yes, this will get the value of the stack pointer when the function was entered - which may be the bottom of the parent function's stack _or_ the start of non-register arguments to this function. So your replacement has always been more correct. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!