iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.34k stars 3.86k forks source link

can libbpf CO-RE work on linux kernel version 4.19? #2905

Open ygdyang opened 4 years ago

ygdyang commented 4 years ago

I have build libbpf-tool on dedian 10 (kernel 4.19.0-8-amd64), but when I run opensnoop, it shows:

libbpf: kernel doesn't support global data libbpf: failed to load object 'opensnoop_bpf' libbpf: failed to load BPF skeleton 'opensnoop_bpf': -95 failed to load BPF object: -95

can libbpf CO-RE work on linux kernel version 4.19?

I did not generate the vmlinux.h for my current kernel version, because CONFIG_DEBUG_INFO_BTF seems can only found in kernel version 5.2 or newer. Is that cause the error message happen?

anakryiko commented 4 years ago

Unfortunately, no, CO-RE won't work unless kernel BTF is present. You need at least commit e83b9f55448a ("kbuild: add ability to generate BTF type info for vmlinux"), which is available starting from 5.2 kernels only. So yeah, in your case kernel is just too old, unfortunately.