libbpf / bpftool

Automated upstream mirror for bpftool stand-alone build.
Other
414 stars 74 forks source link

`bpftool cgroup tree` chokes on systemd's cgroup hierarchy #159

Open arianvp opened 2 months ago

arianvp commented 2 months ago

What I expected to happen

bpftool cgroup tree shows all bpf programs on all cgroups

What happened

The program errored before listing all cgroups with

Error: can't query bpf programs attached to /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice: No such device
$ sudo bpftool cgroup tree
CgroupPath
ID       AttachType      AttachFlags     Name           
/sys/fs/cgroup
181      cgroup_inet_ingress multi           sd_fw_ingress                  
180      cgroup_inet_egress multi           sd_fw_egress                   
/sys/fs/cgroup/workload.slice
    195      cgroup_inet_ingress multi           sd_fw_ingress                  
    194      cgroup_inet_egress multi           sd_fw_egress                   
/sys/fs/cgroup/workload.slice/prometheus.service
    160      cgroup_inet_ingress multi           sd_fw_ingress                  
    159      cgroup_inet_egress multi           sd_fw_egress                   
    158      cgroup_device   multi           sd_devices                     
/sys/fs/cgroup/workload.slice/alertmanager.service
    210      cgroup_inet_ingress multi           sd_fw_ingress                  
    209      cgroup_inet_egress multi           sd_fw_egress                   
    208      cgroup_device   multi           sd_devices                     
/sys/fs/cgroup/workload.slice/prometheus-node-exporter.service
    157      cgroup_inet_ingress multi           sd_fw_ingress                  
    156      cgroup_inet_egress multi           sd_fw_egress                   
    155      cgroup_device   multi           sd_devices                     
/sys/fs/cgroup/workload.slice/grafana.service
    144      cgroup_inet_ingress multi           sd_fw_ingress                  
    143      cgroup_inet_egress multi           sd_fw_egress                   
    142      cgroup_device   multi           sd_devices                     
/sys/fs/cgroup/sys-fs-fuse-connections.mount
    199      cgroup_inet_ingress multi           sd_fw_ingress                  
    198      cgroup_inet_egress multi           sd_fw_egress                   
/sys/fs/cgroup/sys-kernel-config.mount
    205      cgroup_inet_ingress multi           sd_fw_ingress                  
    204      cgroup_inet_egress multi           sd_fw_egress                   
/sys/fs/cgroup/sys-kernel-debug.mount
    203      cgroup_inet_ingress multi           sd_fw_ingress                  
    202      cgroup_inet_egress multi           sd_fw_egress                   
/sys/fs/cgroup/dev-mqueue.mount
    189      cgroup_inet_ingress multi           sd_fw_ingress                  
    188      cgroup_inet_egress multi           sd_fw_egress                   
/sys/fs/cgroup/user.slice
    183      cgroup_inet_ingress multi           sd_fw_ingress                  
    182      cgroup_inet_egress multi           sd_fw_egress                   
/sys/fs/cgroup/user.slice/user-1000.slice
    185      cgroup_inet_ingress multi           sd_fw_ingress                  
    184      cgroup_inet_egress multi           sd_fw_egress                   
/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service
    187      cgroup_inet_ingress multi           sd_fw_ingress                  
    186      cgroup_inet_egress multi           sd_fw_egress                   
Error: can't query bpf programs attached to /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice: No such device
qmonnet commented 2 months ago

Thanks for the report! What's your bpftool version? Could this be a duplicate of https://github.com/libbpf/bpftool/issues/149 (now fixed)?