From: "Emil Tsalapatis" <emil@etsalapatis.com>
To: "Yichong Chen" <chenyichong@uniontech.com>,
<emil@etsalapatis.com>, <qmo@kernel.org>, <ast@kernel.org>,
<daniel@iogearbox.net>, <andrii@kernel.org>, <eddyz87@gmail.com>,
<memxor@gmail.com>
Cc: <martin.lau@linux.dev>, <song@kernel.org>,
<yonghong.song@linux.dev>, <jolsa@kernel.org>,
<jiayuan.chen@linux.dev>, <bpf@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 2/2] tools/bpf/bpftool: Reset vmlinux BTF after struct_ops commands
Date: Mon, 29 Jun 2026 03:45:59 -0400 [thread overview]
Message-ID: <DJLD780OM4II.3JG0MOTVC3L2K@etsalapatis.com> (raw)
In-Reply-To: <9F9017160ABE125F+20260624025055.1574875-3-chenyichong@uniontech.com>
On Tue Jun 23, 2026 at 10:50 PM EDT, Yichong Chen wrote:
> struct_ops frees the global btf_vmlinux object.
>
> In batch mode, a later struct_ops command can reuse stale state.
>
> Reset the BTF pointer and cached map info state.
>
> Fixes: 65c93628599d ("bpftool: Add struct_ops support")
> Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
> ---
> tools/bpf/bpftool/struct_ops.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/bpf/bpftool/struct_ops.c b/tools/bpf/bpftool/struct_ops.c
> index aa43dead249c..835e5e561f7f 100644
> --- a/tools/bpf/bpftool/struct_ops.c
> +++ b/tools/bpf/bpftool/struct_ops.c
> @@ -643,6 +643,10 @@ int do_struct_ops(int argc, char **argv)
> err = cmd_select(cmds, argc, argv, do_help);
>
> btf__free(btf_vmlinux);
> + btf_vmlinux = NULL;
> + map_info_type = NULL;
> + map_info_alloc_len = 0;
> + map_info_type_id = 0;
>
> return err;
> }
prev parent reply other threads:[~2026-06-29 7:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260624025055.1574875-1-chenyichong@uniontech.com>
2026-06-24 2:50 ` [PATCH v4 1/2] tools/bpf/bpftool: Reset vmlinux BTF after map commands Yichong Chen
2026-06-24 2:50 ` [PATCH v4 2/2] tools/bpf/bpftool: Reset vmlinux BTF after struct_ops commands Yichong Chen
2026-06-29 7:45 ` Emil Tsalapatis [this message]
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=DJLD780OM4II.3JG0MOTVC3L2K@etsalapatis.com \
--to=emil@etsalapatis.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chenyichong@uniontech.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=jiayuan.chen@linux.dev \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=qmo@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox