From what I see all the CO-RE relocations applied successfully (even though all the offsets stayed the same, so presumably you compiled your BPF program with vmlinux.h from the exact same kernel you are running it on?). Are you sure that vmlinux image you are providing corresponds to the actual kernel you are running on?
Yep, I have created the following: https://pastebin.ubuntu.com/p/h58YyNr4HR/ to make this easier. It is a 4.15.0-1080 kernel and a 4.15.18+. They are pretty close despite the versioning (second was generated with make deb-dpkg). I’m using same .config file for both, only difference is that the 4.15.18+ was compiled with the changed link-vmlinux.sh file. The /usr/lib/debug/boot/vmlinux files are generated by the same build and I have tried 2 or 3 of the existing packaged kernels. The only thing I did was “pahole -J” to /usr/lib/debug/boot/vmlinux-XXX files (adding the BTF section to them). Running same binary in a 5.8.0-43 kernel works out-of-the-box: https://pastebin.ubuntu.com/p/VKTjMcp6Xs/
I'd start by comparing libbpf logs for vmlinux you get with modified link-vmlinux.sh script and with just explicit pahole -J. If all the CO-RE parts are identical, the problem is somewhere else most probably.
The difference between (1) and (2) from the paste (error and success): libbpf: CO-RE relocating [0] struct task_struct: found target candidate [17361] struct task_struct in [vmlinux] libbpf: CO-RE relocating [0] struct task_struct: found target candidate [17360] struct task_struct in [vmlinux] libbpf: prog 'tcp_connect': relo #0: matching candidate #1 [17361] struct task_struct.comm (0:90 @ offset 2640) libbpf: prog 'tcp_connect': relo #0: matching candidate #1 [17360] struct task_struct.comm (0:90 @ offset 2640) Code is at: https://github.com/rafaeldtinoco/portablebpf and it is not much different than any other libbpf example. thanks again for verifying this! -rafaeldtinoco