All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Justin Chen <justin.chen@broadcom.com>,
	rostedt@goodmis.org, mhiramat@kernel.org, mark.rutland@arm.com,
	linux-trace-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Doug Berger <doug.berger@broadcom.com>
Subject: Re: ARM Ftrace Function Graph Fails With UNWINDER_FRAME_POINTER
Date: Fri, 1 Dec 2023 18:22:54 +0000	[thread overview]
Message-ID: <ZWokflhL8cG7JiCN@shell.armlinux.org.uk> (raw)
In-Reply-To: <CAMj1kXGST7uH530hB0i-rzisNesNrUGsJ5a5eC9805Udi5msrQ@mail.gmail.com>

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!

WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Justin Chen <justin.chen@broadcom.com>,
	rostedt@goodmis.org, mhiramat@kernel.org, mark.rutland@arm.com,
	linux-trace-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Doug Berger <doug.berger@broadcom.com>
Subject: Re: ARM Ftrace Function Graph Fails With UNWINDER_FRAME_POINTER
Date: Fri, 1 Dec 2023 18:22:54 +0000	[thread overview]
Message-ID: <ZWokflhL8cG7JiCN@shell.armlinux.org.uk> (raw)
In-Reply-To: <CAMj1kXGST7uH530hB0i-rzisNesNrUGsJ5a5eC9805Udi5msrQ@mail.gmail.com>

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!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2023-12-01 18:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 23:47 ARM Ftrace Function Graph Fails With UNWINDER_FRAME_POINTER Justin Chen
2023-11-30 23:47 ` Justin Chen
2023-12-01  9:12 ` Ard Biesheuvel
2023-12-01  9:12   ` Ard Biesheuvel
2023-12-01 17:25   ` Justin Chen
2023-12-01 17:25     ` Justin Chen
2023-12-01 18:07     ` Steven Rostedt
2023-12-01 18:07       ` Steven Rostedt
2023-12-01 22:59       ` Justin Chen
2023-12-01 22:59         ` Justin Chen
2023-12-02  6:53         ` Ard Biesheuvel
2023-12-02  6:53           ` Ard Biesheuvel
2023-12-02  8:49           ` Justin Chen
2023-12-02  8:49             ` Justin Chen
2023-12-02  9:26             ` Ard Biesheuvel
2023-12-02  9:26               ` Ard Biesheuvel
2023-12-02 17:49               ` Justin Chen
2023-12-02 17:49                 ` Justin Chen
2023-12-01 18:22   ` Russell King (Oracle) [this message]
2023-12-01 18:22     ` Russell King (Oracle)
2024-05-27  7:43 ` Thorsten Scherer
2024-05-27  7:43   ` Thorsten Scherer
2024-05-27  7:56   ` Russell King (Oracle)
2024-05-27  7:56     ` Russell King (Oracle)
2024-05-27 12:28     ` Uwe Kleine-König
2024-05-27 12:28       ` Uwe Kleine-König
2024-05-27 12:51       ` Russell King (Oracle)
2024-05-27 12:51         ` Russell King (Oracle)
2024-05-28  4:52         ` Thorsten Scherer
2024-05-28  4:52           ` Thorsten Scherer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZWokflhL8cG7JiCN@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=ardb@kernel.org \
    --cc=doug.berger@broadcom.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=justin.chen@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.