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>,
	linux-trace-kernel@vger.kernel.org,
	Kevin Mitchell <kevmitch@arista.com>,
	Dmitry Safonov <dima@arista.com>
Subject: Re: ftrace: sorttable unable to sort ELF64 on 32-bit host
Date: Mon, 24 Mar 2025 11:52:33 -0700	[thread overview]
Message-ID: <2025032424-custard-volley-bbb6@gregkh> (raw)
In-Reply-To: <CABEuK15jWHSU8LaRXc1EzvhiLdBHeM9E+sKs7VyP47RRSxG6cg@mail.gmail.com>

On Mon, Mar 24, 2025 at 01:39:12PM -0500, Sahil Gupta wrote:
> > > Hi Steven,
> > >
> > > On 6.12.0, sorttable is unable to sort 64-bit ELFs on 32-bit hosts because
> > > of the parsing of the start_mcount_loc and stop_mcount_loc values in
> > > get_mcount_loc():
> > >
> > >   *_start = strtoul(start_buff, NULL, 16);
> > >
> > > and
> > >
> > >  *_stop = strtoul(stop_buff, NULL, 16);
> > >
> > > This code makes the (often correct) assumption that the host and the target
> > > have the same architecture, however it runs into issues when compiling for
> > > a 64-bit target on a 32-bit host, as unsigned long is shorter than the
> > > pointer width. As a result, I've noticed that both start and stop max out
> > > at 2^32 - 1.
> >
> > So this has been broken for some time?
> 
> Since 2021, it seems like. However, this slipped from my radar since
> we've been using 5.10 for the longest time, which didn't have
> CONFIG_BUILDTIME_MCOUNT_SORT.
> 
> > >
> > > It seems that commit 4acda8ed fixes this issue inadvertently by directly
> > > extracting them from the ELF using the correct width. I'm wondering if it
> > > is possible to backport this as well as the other sorttable refactors to
> > > 6.12.0 since they fix this issue.
> >
> > You should ask Greg KH on this.
> 
> Sounds good, tagging Greg.

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

  reply	other threads:[~2025-03-24 18:53 UTC|newest]

Thread overview: 22+ 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 [this message]
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
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
2025-03-20 22:02 ftrace: sorttable unable to sort ELF64 on 32-bit host Sahil Gupta
2026-01-06 17:21 ` Steven Rostedt
2026-01-06 17:39   ` 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=2025032424-custard-volley-bbb6@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 \
    /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