libbpf / libbpf-bootstrap

Scaffolding for BPF application development with libbpf and BPF CO-RE
BSD 3-Clause "New" or "Revised" License
1.05k stars 286 forks source link

Is it possible to compile or run a BPF program that invokes task_struct in an environment without BTF support #283

Open Pyrokine opened 1 month ago

Pyrokine commented 1 month ago

My environment does not support BTF and CO-RE (cannot enable CONFIG_DEBUG_INFO_BTF), but I need task_struct to get some task info. What's the best way to implement the code?

libbpf: kernel BTF is missing at '/sys/kernel/btf/vmlinux', was CONFIG_DEBUG_INFO_BTF enabled?
libbpf: failed to find valid kernel BTF
libbpf: Error loading vmlinux BTF: -3
libbpf: failed to load object 'bootstrap_bpf'
libbpf: failed to load BPF skeleton 'bootstrap_bpf': -3
Failed to load and verify BPF skeleton
anakryiko commented 1 month ago

You'll have to use kernel headers, which I believe are packaged as a separate package on some distros.