]> www.infradead.org Git - users/dwmw2/linux.git/commit
bpftool: Query only cgroup-related attach types
authorKenta Tada <tadakentaso@gmail.com>
Fri, 7 Jun 2024 11:17:04 +0000 (20:17 +0900)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 11 Jun 2024 18:39:09 +0000 (11:39 -0700)
commit98b303c9bf05dae932efbd71e18d81f6c64f20d8
treee5214d06ca6fc657db34bbc70c0675aa6660dbab
parentbb678f01804ccaa861b012b2b9426d69673d8a84
bpftool: Query only cgroup-related attach types

When CONFIG_NETKIT=y,
bpftool-cgroup shows error even if the cgroup's path is correct:

$ bpftool cgroup tree /sys/fs/cgroup
CgroupPath
ID       AttachType      AttachFlags     Name
Error: can't query bpf programs attached to /sys/fs/cgroup: No such device or address

>From strace and kernel tracing, I found netkit returned ENXIO and this command failed.
I think this AttachType(BPF_NETKIT_PRIMARY) is not relevant to cgroup.

bpftool-cgroup should query just only cgroup-related attach types.

v2->v3:
  - removed an unnecessary check

v1->v2:
  - used an array of cgroup attach types

Signed-off-by: Kenta Tada <tadakentaso@gmail.com>
Reviewed-by: Quentin Monnet <qmo@kernel.org>
Link: https://lore.kernel.org/r/20240607111704.6716-1-tadakentaso@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/bpf/bpftool/cgroup.c