From: "Ihor Solodrai" <ihor.solodrai@linux.dev>
To: "Vasily Gorbik" <gor@linux.ibm.com>,
"Steven Rostedt" <rostedt@goodmis.org>
Cc: "Masami Hiramatsu" <mhiramat@kernel.org>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Nathan Chancellor" <nathan@kernel.org>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH] scripts/sorttable: Fix endianness handling in build-time mcount sort
Date: Wed, 02 Apr 2025 23:22:40 +0000 [thread overview]
Message-ID: <6acbc2347a86153c2646a4bfebaa226e9b0e01f7@linux.dev> (raw)
In-Reply-To: <patch.git-dca31444b0f1.your-ad-here.call-01743554658-ext-8692@work.hours>
On 4/1/25 6:15 PM, Vasily Gorbik wrote:
> Kernel cross-compilation with BUILDTIME_MCOUNT_SORT produces zeroed
> mcount values if the build-host endianness does not match the ELF
> file endianness.
>
> The mcount values array is converted from ELF file
> endianness to build-host endianness during initialization in
> fill_relocs()/fill_addrs(). Avoid extra conversion of these values during
> weak-function zeroing; otherwise, they do not match nm-parsed addresses
> and all mcount values are zeroed out.
>
> Fixes: ef378c3b8233 ("scripts/sorttable: Zero out weak functions in mcount_loc table")
> Reported-by: Ilya Leoshkevich <iii@linux.ibm.com>
> Reported-by: Ihor Solodrai <ihor.solodrai@linux.dev>
> Closes: https://lore.kernel.org/all/your-ad-here.call-01743522822-ext-4975@work.hours/
> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
> ---
> scripts/sorttable.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/sorttable.c b/scripts/sorttable.c
> index 7b4b3714b1af..deed676bfe38 100644
> --- a/scripts/sorttable.c
> +++ b/scripts/sorttable.c
> @@ -857,7 +857,7 @@ static void *sort_mcount_loc(void *arg)
> for (void *ptr = vals; ptr < vals + size; ptr += long_size) {
> uint64_t key;
>
> - key = long_size == 4 ? r((uint32_t *)ptr) : r8((uint64_t *)ptr);
> + key = long_size == 4 ? *(uint32_t *)ptr : *(uint64_t *)ptr;
> if (!find_func(key)) {
> if (long_size == 4)
> *(uint32_t *)ptr = 0;
Hi Vasily,
I can confirm that this patch fixes BPF selftests on s390x:
https://github.com/kernel-patches/vmtest/actions/runs/14231181710
Tested-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Thank you!
next prev parent reply other threads:[~2025-04-02 23:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 1:15 [PATCH] scripts/sorttable: Fix endianness handling in build-time mcount sort Vasily Gorbik
2025-04-02 23:22 ` Ihor Solodrai [this message]
2025-04-02 23:28 ` Steven Rostedt
2025-04-02 23:32 ` Ihor Solodrai
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=6acbc2347a86153c2646a4bfebaa226e9b0e01f7@linux.dev \
--to=ihor.solodrai@linux.dev \
--cc=agordeev@linux.ibm.com \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=iii@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=nathan@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.