From: Quentin Monnet <qmo@kernel.org>
To: Arsalan Yavari <arya48.yavari79@gmail.com>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>,
Ihor Solodrai <ihor.solodrai@linux.dev>
Subject: Re: [PATCH bpf] bpftool: Fix address comparison in kernel_syms_cmp()
Date: Fri, 4 Dec 2026 17:55:48 +0000 [thread overview]
Message-ID: <8e708e96-35f9-4dd7-a97f-522cfa85df76@kernel.org> (raw)
In-Reply-To: <20261204170206.73462-1-arya48.yavari79@gmail.com>
On 04/12/2026 17:02, Arsalan Yavari wrote:
> kernel_syms_cmp() subtracts two unsigned long symbol addresses and
> returns the result as an int. On 64-bit systems this truncates the
> difference to 32 bits, and on 32-bit systems unsigned differences
> above INT_MAX become negative.
>
> When /proc/kallsyms contains addresses at least 2 GiB apart, such as
> low per-CPU symbol offsets alongside kernel text and module addresses,
> the comparator can return the wrong sign or 0 for distinct addresses.
> This breaks the qsort() ordering of dd->sym_mapping and causes
> bsearch() in kernel_syms_search() to miss symbols or match the wrong
> entry.
>
> Compare the addresses directly instead of subtracting them, matching
> cmp_addr_cookie() in link.c.
>
> Fixes: 7105e828c087 ("bpf: allow for correlation of maps and helpers in dump")
> Signed-off-by: Arsalan Yavari <arya48.yavari79@gmail.com>
Looks correct, thank you.
Acked-by: Quentin Monnet <qmo@kernel.org>
Did you actually hit the issue? On what arch, if you don't mind me asking?
Thanks,
Quentin
next prev parent reply other threads:[~2026-12-04 17:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 17:02 [PATCH bpf] bpftool: Fix address comparison in kernel_syms_cmp() Arsalan Yavari
2026-12-04 17:55 ` Quentin Monnet [this message]
2026-12-04 18:36 ` AmirArsalan Yavari Darani
2026-12-05 3:50 ` patchwork-bot+netdevbpf
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=8e708e96-35f9-4dd7-a97f-522cfa85df76@kernel.org \
--to=qmo@kernel.org \
--cc=andrii@kernel.org \
--cc=arya48.yavari79@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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.