bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
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 <bpf@vger.kernel.org>
Subject: Re: libbpf/BTF loading issue with fentry/fexit selftests
Date: Wed, 25 Mar 2020 18:31:38 -0700	[thread overview]
Message-ID: <CAEf4BzbN0rdiLvSe3_669FMKcV99RXrnKAKDtr8GnRP+4omQsw@mail.gmail.com> (raw)
In-Reply-To: <CAGyo_hqRCs6hp7w6zWEf5RzEZF6zyXj_Bb_AgXVKgab7tg06NQ@mail.gmail.com>

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.

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

  parent reply	other threads:[~2020-03-26  1:31 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 [this message]
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=CAEf4BzbN0rdiLvSe3_669FMKcV99RXrnKAKDtr8GnRP+4omQsw@mail.gmail.com \
    --to=andrii.nakryiko@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=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;
as well as URLs for NNTP newsgroup(s).