From: Matt Cover <werekraken@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andriin@fb.com>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
bpf <bpf@vger.kernel.org>
Subject: Re: libbpf/BTF loading issue with fentry/fexit selftests
Date: Wed, 25 Mar 2020 19:50:35 -0700 [thread overview]
Message-ID: <CAGyo_hpM82LmdijTqpTz2DbmjvYi+F17xXHtQQ2QN9a9iJCA7A@mail.gmail.com> (raw)
In-Reply-To: <CAEf4BzbN0rdiLvSe3_669FMKcV99RXrnKAKDtr8GnRP+4omQsw@mail.gmail.com>
On Wed, Mar 25, 2020 at 6:31 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Wed, Mar 25, 2020 at 3:16 PM Matt Cover <werekraken@gmail.com> 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.
Thanks Andrii! pahole 1.16 fixed things up.
[vagrant@localhost bpf]$ uname -r
5.5.9-1.btf.2.el7.x86_64
[vagrant@localhost bpf]$ ~/bpftool btf dump file
/sys/kernel/btf/vmlinux | grep -i 'fentry\|fexit'
'BPF_TRAMP_FENTRY' val=0
'BPF_TRAMP_FEXIT' val=1
'BPF_TRACE_FENTRY' val=24
'BPF_TRACE_FEXIT' val=25
'fentry_progs' type_id=1950
'fentry_cnt' type_id=18
'fexit_progs' type_id=1950
'fexit_cnt' type_id=18
[59594] FUNC 'bpf_fentry_test1' type_id=59593
[59596] FUNC 'bpf_fentry_test2' type_id=59595
[59598] FUNC 'bpf_fentry_test3' type_id=59597
[59600] FUNC 'bpf_fentry_test4' type_id=59599
[59602] FUNC 'bpf_fentry_test5' type_id=59601
[59604] FUNC 'bpf_fentry_test6' type_id=59603
[vagrant@localhost bpf]$ sudo ./test_progs -t fexit_test
#10 fexit_test:OK
Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED
>
> >
> >
> > [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.
prev parent reply other threads:[~2020-03-26 2:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-25 22:16 libbpf/BTF loading issue with fentry/fexit selftests Matt Cover
2020-03-25 22:23 ` KP Singh
2020-03-25 23:42 ` Matt Cover
2020-03-26 1:31 ` Andrii Nakryiko
2020-03-26 2:50 ` Matt Cover [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAGyo_hpM82LmdijTqpTz2DbmjvYi+F17xXHtQQ2QN9a9iJCA7A@mail.gmail.com \
--to=werekraken@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andriin@fb.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).