From: Matt Cover <werekraken@gmail.com>
To: KP Singh <kpsingh@chromium.org>
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@vger.kernel.org
Subject: Re: libbpf/BTF loading issue with fentry/fexit selftests
Date: Wed, 25 Mar 2020 16:42:07 -0700 [thread overview]
Message-ID: <CAGyo_hoS0t-ADUxt7gqGYpU=8oZx=Asxsdxq=mzbP9v78rgMmA@mail.gmail.com> (raw)
In-Reply-To: <20200325222345.GA27005@chromium.org>
On Wed, Mar 25, 2020 at 3:23 PM KP Singh <kpsingh@chromium.org> wrote:
>
> On 25-Mär 15:16, Matt Cover 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.
> >
> >
> > [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`
>
> It seems like you might have CONFIG_TEST_BPF disabled.
>
> This is explained in Documentation/filter.txt:
>
> Testing
> -------
>
> Next to the BPF toolchain, the kernel also ships a test module that
> contains various test cases for classic and internal BPF that can be
> executed against the BPF interpreter and JIT compiler. It can be found
> in lib/test_bpf.c and enabled via Kconfig:
>
> CONFIG_TEST_BPF=m
>
> After the module has been built and installed, the test suite can be
> executed via insmod or modprobe against 'test_bpf' module. Results of
> the test cases including timings in nsec can be found in the kernel
> log (dmesg).
Thanks for the info KP. Unfortunately, the issue remains with
CONFIG_TEST_BPF=m and test_bpf loaded.
[vagrant@localhost bpf]$ uname -r
5.5.9-1.btf.1.el7.x86_64
[vagrant@localhost bpf]$ grep CONFIG_TEST_BPF /boot/config-`uname -r`
CONFIG_TEST_BPF=m
[vagrant@localhost bpf]$ sudo modprobe test_bpf
[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
[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
The -vvv output didn't change, so forgoing a second copy.
>
> - KP
>
> > 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
>
> [...]
>
> > libbpf: collecting relocating info for: 'fexit/bpf_fentry_test6'
> > libbpf: relo for shdr 16, symb 32, value 40, type 1, bind 1, name 34
> > ('test6_result'), insn 18
> > libbpf: found data map 0 (fexit_te.bss, sec 16, off 0) for insn 18
> > libbpf: loading kernel BTF '/sys/kernel/btf/vmlinux': 0
> > 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
> >
> >
> > Any hints on the issue?
> >
> > -Matt C.
next prev parent reply other threads:[~2020-03-25 23:42 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 [this message]
2020-03-26 1:31 ` Andrii Nakryiko
2020-03-26 2:50 ` Matt Cover
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_hoS0t-ADUxt7gqGYpU=8oZx=Asxsdxq=mzbP9v78rgMmA@mail.gmail.com' \
--to=werekraken@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andriin@fb.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@chromium.org \
--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).