BPF List
 help / color / mirror / Atom feed
From: KP Singh <kpsingh@chromium.org>
To: Matt Cover <werekraken@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@vger.kernel.org
Subject: Re: libbpf/BTF loading issue with fentry/fexit selftests
Date: Wed, 25 Mar 2020 23:23:45 +0100	[thread overview]
Message-ID: <20200325222345.GA27005@chromium.org> (raw)
In-Reply-To: <CAGyo_hqRCs6hp7w6zWEf5RzEZF6zyXj_Bb_AgXVKgab7tg06NQ@mail.gmail.com>

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).

- 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.

  reply	other threads:[~2020-03-25 22:23 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 [this message]
2020-03-25 23:42   ` Matt Cover
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=20200325222345.GA27005@chromium.org \
    --to=kpsingh@chromium.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andriin@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=werekraken@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