linux/tools
Yichong Chen bda6a7308e bpftool: Fix vmlinux BTF leak in cgroup commands
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: 596f5fb2ea ("bpftool: implement cgroup tree for BPF_LSM_CGROUP")
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
Reviewed-by: Quentin Monnet <qmo@kernel.org>
Link: https://lore.kernel.org/r/24357C69B4405079+20260617090117.280222-1-chenyichong@uniontech.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-06-21 18:02:10 -07:00
..
accounting tools/accounting/getdelays: fix -Wformat-truncation warning in format_timespec 2026-05-28 21:24:40 -07:00
arch x86/cpu updates for v7.2: 2026-06-15 15:25:17 +05:30
bootconfig Bootconfig updates for v7.2 2026-06-16 17:29:24 +05:30
bpf bpftool: Fix vmlinux BTF leak in cgroup commands 2026-06-21 18:02:10 -07:00
build libbpf: Add __NR_bpf definition for LoongArch 2026-05-28 14:38:15 -07:00
certs
cgroup
counter
crypto
debugging
dma
docs docs: kdoc_diff: add a helper tool to help checking kdoc regressions 2026-03-30 10:54:13 -06:00
firewire
firmware
gpio
hv tools: hv: Fix cross-compilation 2026-04-14 04:43:26 +00:00
iio
include bpf-next-7.2 2026-06-17 09:18:14 +01:00
kvm/kvm_stat
laptop
leds
lib bpf-next-7.2 2026-06-17 09:18:14 +01:00
memory-model
mm mm.git review status for mm-hotfixes-stable..mm-stable 2026-06-19 10:14:34 -07:00
net tools: ynl: try to avoid the very slow YAML loader 2026-06-04 15:36:12 -07:00
objtool objtool/klp: Cache dont_correlate() result 2026-05-04 21:16:07 -07:00
pcmcia
perf This update includes the following changes: 2026-06-16 09:01:23 +05:30
power Power management updates for 7.2-rc1 2026-06-15 11:37:18 +05:30
rcu
sched
sched_ext sched_ext: Changes for v7.2 2026-06-17 12:10:11 +01:00
scripts Kbuild/Kconfig updates for 7.1 2026-04-14 09:18:40 -07:00
sound
spi
testing bpf: Allow type tag BTF records to succeed other modifier records 2026-06-21 17:59:44 -07:00
thermal
time
tracing rtla: Fix parsing of multi-character short options 2026-06-04 10:53:25 +02:00
unittests docs: kernel-doc: python: strip __counted_by_ptr macro 2026-05-15 08:11:36 -06:00
usb usbip: tools: add hint when no exported devices are found 2026-04-11 12:02:00 +02:00
verification verification/rvgen: Fix ltl2k writing True as a literal 2026-06-04 16:44:25 +02:00
virtio tools/virtio: fix build for kmalloc_obj API and missing stubs 2026-06-10 02:16:59 -04:00
wmi
workqueue tools/workqueue: add CACHE_SHARD support to wq_dump.py 2026-04-01 10:24:18 -10:00
writeback
Makefile