lsm_cgroup programs fail to load: Tracing programs must provide btf_id
Author: danielpacakCreated Sep 24, 2026Updated Sep 24, 2026
Labelsbug
Describe the bug
I was experimenting with attaching per-pod LSM policies with lsm_cgroup/ in Kubernetes and bumped into the following error:
load program: invalid argument:
Tracing programs must provide btf_idThe ELF reader already maps lsm_cgroup+ to BPF_LSM_CGROUP. But findProgramTargetInKernel only looks up bpf_lsm_<hook> for AttachLSMMac, so the program is loaded without attach_btf_id.
libbpf resolves both attach types identically, in btf_get_kernel_prefix_kind() so I expect cilium/ebpf to work the same.
How to reproduce
Load any SEC("lsm_cgroup/file_open") program with LoadAndAssign, on kernel 6.0 or newer.
Version information
github.com/cilium/ebpf v0.22.0 and f788cf14 kernel 6.12.94, arm64, Debian
Source: cilium/ebpf