From: Quentin Monnet <qmo@kernel.org>
To: Tianyi Chen <hi@tychen.cc>, bpf@vger.kernel.org
Cc: andrii@kernel.org, eddyz87@gmail.com, ihor.solodrai@linux.dev,
linux-kselftest@vger.kernel.org, skokovmaksimevg@gmail.com
Subject: Re: [PATCH bpf-next 1/2] bpftool: Reset map info before each query in show and dump loops
Date: Tue, 29 Sep 2026 11:28:53 +0100 [thread overview]
Message-ID: <0e477c5d-4fa2-464d-bbf0-853804fa07f9@kernel.org> (raw)
In-Reply-To: <14f8779c59411e88bc320f1064a94aa580ca5be8.1790615923.git.hi@tychen.cc>
2026-09-29 02:13 UTC+0900 ~ Tianyi Chen <hi@tychen.cc>
> The kernel copies bpf_map_info from userspace and only fills in the BTF
> fields when a map has BTF. Reusing the structure for a later map without
> BTF therefore retains the preceding map's BTF IDs.
>
> Clear the structure and restore its length before each query in map
> listing, named-map listing, BTF detection and dumping. This prevents
> reporting stale BTF IDs, choosing BTF output for mixed map selections,
> and formatting a map with another map's key and value types.
>
> Reported-by: Quentin Monnet <qmo@kernel.org>
> Link: https://lore.kernel.org/r/3acbe829-06f0-4df4-b57c-a8c7b802ec96@kernel.org
> Assisted-by: LLM
> Signed-off-by: Tianyi Chen <hi@tychen.cc>
Fixes: 71bb428fe2c1 ("tools: bpf: add bpftool")
Fixes: 99f9863a0c45 ("bpftool: Match maps by name")
Acked-by: Quentin Monnet <qmo@kernel.org>
Thanks for this.
next prev parent reply other threads:[~2026-09-29 10:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 17:18 [PATCH bpf-next 0/2] bpftool: Reset map info between queries Tianyi Chen
2026-09-28 17:13 ` [PATCH bpf-next 1/2] bpftool: Reset map info before each query in show and dump loops Tianyi Chen
2026-09-29 10:28 ` Quentin Monnet [this message]
2026-09-28 17:13 ` [PATCH bpf-next 2/2] selftests/bpf: Check bpftool map info across mixed BTF maps Tianyi Chen
2026-09-29 10:28 ` Quentin Monnet
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=0e477c5d-4fa2-464d-bbf0-853804fa07f9@kernel.org \
--to=qmo@kernel.org \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=eddyz87@gmail.com \
--cc=hi@tychen.cc \
--cc=ihor.solodrai@linux.dev \
--cc=linux-kselftest@vger.kernel.org \
--cc=skokovmaksimevg@gmail.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