From: Quentin Monnet <qmo@kernel.org>
To: Yichong Chen <chenyichong@uniontech.com>,
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, sdf@fomichev.me, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tools/bpf/bpftool: Fix vmlinux BTF leak in cgroup commands
Date: Fri, 19 Jun 2026 16:43:33 +0100 [thread overview]
Message-ID: <fcb66294-b3ca-4bf1-970d-23e4a7431757@kernel.org> (raw)
In-Reply-To: <24357C69B4405079+20260617090117.280222-1-chenyichong@uniontech.com>
2026-06-17 17:01 UTC+0800 ~ Yichong Chen <chenyichong@uniontech.com>
> bpftool cgroup show and tree call libbpf_find_kernel_btf() to
> resolve attach_btf names, but never release the returned BTF object.
>
> For cgroup tree, do_show_tree_fn() is called once for each cgroup
> visited by nftw(). When more than one cgroup has attached programs,
> each callback overwrites btf_vmlinux with a new object and loses the
> previous allocation.
>
> Load vmlinux BTF only once during a tree walk and release it when
> cgroup show or tree completes. Reset btf_vmlinux_id at the same time
> so batch mode starts with clean state.
>
> Fixes: 596f5fb2ea2a ("bpftool: implement cgroup tree for BPF_LSM_CGROUP")
> Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
Reviewed-by: Quentin Monnet <qmo@kernel.org>
Thank you.
It seems that Sashiko is right regarding the occurrences in struct_ops.c
and map.c, would you mind following up with the related fixes, please?
Thanks,
Quentin
next prev parent reply other threads:[~2026-06-19 15:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-17 9:01 Yichong Chen
2026-06-19 15:43 ` Quentin Monnet [this message]
2026-06-22 1:10 ` 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=fcb66294-b3ca-4bf1-970d-23e4a7431757@kernel.org \
--to=qmo@kernel.org \
--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=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=sdf@fomichev.me \
--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
all inboxes | Powered by JetHome®