iovisor / bcc

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

libbpf CO-RE failed on kernel 6.1.59 #4815

Closed weitsochen closed 10 months ago

weitsochen commented 10 months ago

Hi,

I want to consult the CO-RE failure on kernel 6.1.59.

The error is

libbpf: failed to find valid kernel BTF
libbpf: Error loading vmlinux BTF: -3
libbpf: failed to load object 'patrol_bpf'
libbpf: failed to load BPF skeleton 'patrol_bpf': -3

I can confirm that CO-RE is enabled.

[root@admin]# cat /boot/config  | grep CONFIG_DEBUG_INFO_BTF
CONFIG_DEBUG_INFO_BTF=y
CONFIG_DEBUG_INFO_BTF_MODULES=y

[root@admin]# ls -la /sys/kernel/btf/vmlinux
-r--r--r--. 1 root root 4601363 Nov 28 18:21 /sys/kernel/btf/vmlinux

Kernel version is 6.1.59

[root@admin]# uname -r
6.1.59

I am thinking if there is anything that I missed. Our application can run on kernels from 5.4 to 5.15 previously.

weitsochen commented 10 months ago

We were using the old 0.8.1: https://github.com/libbpf/libbpf/tree/d4fc7a517676078d9e79dc3a6b5aa28b1c90e7e4.

After upgrade to newer version of libbpf, the issue is solved.

Below is the detailed logs, and BTF_KIND_ENUM64 is not supported in the older version.

libbpf: Unsupported BTF_KIND:19
libbpf: loading kernel BTF '/sys/kernel/btf/vmlinux': -22
libbpf: failed to find valid kernel BTF
libbpf: Error loading vmlinux BTF: -3
libbpf: failed to load object 'patrol_bpf'
libbpf: failed to load BPF skeleton 'patrol_bpf': -3