Seem like I was missing few things:
The -g
is needed for the bpf program (btf needs DWARF symbols?).
The extern declaration in bpf program must also have __ksym
: extern int foo_bar(struct pt_regs *regs) __ksym;
I also needed to #include <asm/ptrace.h>
in bpf program and in kernel module (struct pt_regs
is defined there).