On Wed, Mar 25, 2020 at 3:16 PM Matt Cover <werekraken@xxxxxxxxx> wrote: > > I'm looking to explore the bpf trampoline Alexei introduced for > tracing progs, but am encountering a libbpf/BTF issue with loading > the selftests. Hoping you guys might have a pointer or two. > > The kernel build used pahole 1.15. All llvm-project components used > in compiling the selftests were 10.0.0-rc6. > > I believe the following confirms that BTF is indeed present in this kernel. BTF is, but that BTF doesn't have information about FUNCs (only FUNC_PROTOs). You need pahole 1.16 for fentry/fexit. > > > [vagrant@localhost bpf]$ uname -r > 5.5.9-1.btf.el7.x86_64 > [vagrant@localhost bpf]$ grep CONFIG_DEBUG_INFO_BTF /boot/config-`uname -r` > CONFIG_DEBUG_INFO_BTF=y > [vagrant@localhost bpf]$ ~/bpftool btf dump file ~/vmlinux-`uname -r` > | grep -i fexit > 'BPF_TRAMP_FEXIT' val=1 > 'BPF_TRACE_FEXIT' val=25 > [vagrant@localhost bpf]$ ~/bpftool btf dump file > /sys/kernel/btf/vmlinux | grep -i fexit > 'BPF_TRAMP_FEXIT' val=1 > 'BPF_TRACE_FEXIT' val=25 > > > The fexit_test.o file also has BTF information. > > > [vagrant@localhost bpf]$ ~/bpftool btf dump file fexit_test.o | grep FUNC_PROTO > [4] FUNC_PROTO '(anon)' ret_type_id=5 vlen=1 > [7] FUNC_PROTO '(anon)' ret_type_id=5 vlen=1 > [9] FUNC_PROTO '(anon)' ret_type_id=5 vlen=1 > [11] FUNC_PROTO '(anon)' ret_type_id=5 vlen=1 > [13] FUNC_PROTO '(anon)' ret_type_id=5 vlen=1 > [15] FUNC_PROTO '(anon)' ret_type_id=5 vlen=1 > > > However, I get libbpf/BTF load errors when trying to run any > fentry/fexit tests. > > > [vagrant@localhost bpf]$ sudo ./test_progs -t fexit_test | grep '^libbpf\|FAIL' > libbpf: Error loading BTF: Invalid argument(22) > libbpf: magic: 0xeb9f > libbpf: Error loading .BTF into kernel: -22. > libbpf: Error loading BTF: Invalid argument(22) > libbpf: magic: 0xeb9f > libbpf: Error loading .BTF into kernel: -22. > libbpf: fexit/bpf_fentry_test1 is not found in vmlinux BTF > test_fexit_test:FAIL:prog_load fail err -2 errno 22 > #10 fexit_test:FAIL > Summary: 0/0 PASSED, 0 SKIPPED, 1 FAILED > > > I saw in a similar thread that -vvv output was requested. Figured the > same applies here. Yeah, for tricky issues that good. In this case it was pretty obvious, but generally it's a good idea for sure, thanks! > > > [vagrant@localhost bpf]$ sudo ./test_progs -vvv -t fexit_test | grep > '^libbpf\|FAIL' [...] > > > Any hints on the issue? > > -Matt C.