Linux Trace Kernel
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Sahil Gupta <s.gupta@arista.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	stable@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	Dmitry Safonov <dima@arista.com>,
	Kevin Mitchell <kevmitch@arista.com>
Subject: Re: [PATCH 6.1 6.6 6.12 6.13] scripts/sorttable: fix ELF64 mcount_loc address parsing when compiling on 32-bit
Date: Tue, 25 Mar 2025 20:23:31 -0400	[thread overview]
Message-ID: <2025032553-celibacy-underpaid-faeb@gregkh> (raw)
In-Reply-To: <20250326001122.421996-2-s.gupta@arista.com>

On Tue, Mar 25, 2025 at 05:06:56PM -0700, Sahil Gupta wrote:
> The ftrace __mcount_loc buildtime sort does not work properly when the host is
> 32-bit and the target is 64-bit. sorttable parses the start and stop addresses
> by calling strtoul on the buffer holding the hexadecimal string. Since the
> target is 64-bit but unsigned long on 32-bit machines is 32 bits, strtoul,
> and by extension the start and stop addresses, can max out to 2^32 - 1.
> 
> This patch adds a new macro, parse_addr, that corresponds to a strtoul
> or strtoull call based on whether you are operating on a 32-bit ELF or
> a 64-bit ELF. This way, the correct width is guaranteed whether or not
> the host is 32-bit. This should cleanly apply on all of the 6.x stable
> kernels.
> 
> Manually verified that the __mcount_loc section is sorted by parsing the
> ELF and verified tests corresponding to CONFIG_FTRACE_SORT_STARTUP_TEST
> for kernels built on a 32-bit and a 64-bit host.
> 
> Signed-off-by: Sahil Gupta <s.gupta@arista.com>
> ---
>  scripts/sorttable.h | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

What is the upstream git commit of this?

If it's not upstream, then you need to document the heck out of why we
can't take whatever is upstream already, which I don't see here :(

thanks,

greg k-h

  reply	other threads:[~2025-03-26  0:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CABEuK15=+Bo7xkBn5ufytVowt0j3fVEsdGVsryn1zH8KxfoCyQ@mail.gmail.com>
2025-03-24 17:36 ` ftrace: sorttable unable to sort ELF64 on 32-bit host Steven Rostedt
2025-03-24 18:39   ` Sahil Gupta
2025-03-24 18:52     ` Greg KH
2025-03-24 19:07       ` Steven Rostedt
2025-03-25 11:58         ` Greg KH
2025-03-25 12:15           ` Steven Rostedt
2025-03-25 17:52             ` Sahil Gupta
2025-03-25 18:02               ` Steven Rostedt
2025-03-25 18:10                 ` Sahil Gupta
2025-03-25 18:19                   ` Steven Rostedt
2025-03-25 18:23                     ` Sahil Gupta
2025-03-26  0:06                       ` [PATCH 6.1 6.6 6.12 6.13] scripts/sorttable: fix ELF64 mcount_loc address parsing when compiling on 32-bit Sahil Gupta
2025-03-26  0:23                         ` Greg KH [this message]
2025-03-26  0:32                           ` Steven Rostedt
2025-03-26  0:37                             ` Steven Rostedt
2025-03-26  0:45                               ` Greg KH
2025-03-26  0:47                                 ` Steven Rostedt
2025-03-26  1:07                                   ` Sahil Gupta
2025-05-03 10:24                                     ` Sahil Gupta

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=2025032553-celibacy-underpaid-faeb@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=dima@arista.com \
    --cc=kevmitch@arista.com \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=s.gupta@arista.com \
    --cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox