From: Shung-Hsi Yu <shung-hsi.yu@suse.com>
To: Vincent Li <vincent.mc.li@gmail.com>
Cc: bpf <bpf@vger.kernel.org>
Subject: Re: libbpf: failed to load program 'vxlan_get_tunnel_src'
Date: Mon, 23 May 2022 16:18:10 +0800 [thread overview]
Message-ID: <YotDQtN4qhqBVi22@syu-laptop> (raw)
In-Reply-To: <YotBr8cRTx8qt8Ot@syu-laptop>
On Mon, May 23, 2022 at 04:11:27PM +0800, Shung-Hsi Yu wrote:
> On Thu, May 19, 2022 at 08:25:00AM -0700, Vincent Li wrote:
> > Hi,
> >
> > Here is my step to run bpf selftest on Ubuntu 20.04.2 LTS
> >
> > git clone https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
> > cd bpf-next; cp /boot/config-5.10.0-051000-generic .config; yes "" |
> > make oldconfig; make bzImage; make modules; cd
> > tools/testing/selftests/bpf/; make
>
> [snip...]
>
> > ; bpf_printk("vxlan key %d local ip 0x%x remote ip 0x%x gbp 0x%x\n",
> >
> > 46: (7b) *(u64 *)(r10 -88) = r2
> >
> > 47: (7b) *(u64 *)(r10 -72) = r1
> >
> > 48: (61) r1 = *(u32 *)(r10 -48)
> >
> > 49: (7b) *(u64 *)(r10 -96) = r1
> >
> > 50: (61) r1 = *(u32 *)(r10 -44)
> >
> > 51: (7b) *(u64 *)(r10 -80) = r1
> >
> > 52: (bf) r3 = r10
> >
> > 53: (07) r3 += -96
> >
> > 54: (18) r1 = 0xffffabaec02c82af
> >
> > 56: (b4) w2 = 52
> >
> > 57: (b4) w4 = 32
> >
> > 58: (85) call unknown#177
> >
> > invalid func unknown#177
>
> This should be the reason that why vxlan_get_tunnel_src fails to load, the
> kernel does not recognize the helper function that the program is trying to
> call.
Just realized Andrii already pointed this out in an earlier email. Consider
this an expanded answer to his then :)
> And that helper function is bpf_trace_vprintk (determined with v5.17.4
> vmlinux).
>
> $ bpftool btf dump file /sys/kernel/btf/vmlinux format c | grep -e 'BPF_FUNC_.* 177,'
> BPF_FUNC_trace_vprintk = 177,
>
> Based on your description you're using a v5.10-based kernel, which explains
> why it doesn't have bpf_trace_vprintk(), since it was not added until commit
> 10aceb629e19 ("bpf: Add bpf_trace_vprintk helper") in v5.16.
>
> The call to bpf_trace_vprintk() comes from the bpf_printk() call, which is
> actually a macro that uses either bpf_trace_printk() or bpf_trace_vprintk()
> depending on the number of arguments given[1].
>
> In general I think it'd make more sense to run bpf-next selftests on a
> bpf-next kernel, either compile and install on the machine that you're
> testing on or use tools/testing/selftests/bpf/vmtest.sh which spins up a VM
> with suitable environment (though I haven't tried vmtest.sh myself).
>
>
> Shung-Hsi
>
> 1: https://github.com/libbpf/libbpf/blob/master/src/bpf_helpers.h
>
> > processed 64 insns (limit 1000000) max_states_per_insn 1 total_states
> > 5 peak_states 5 mark_read 2
> >
> > -- END PROG LOAD LOG --
> >
> > libbpf: failed to load program 'vxlan_get_tunnel_src'
> >
> > libbpf: failed to load object 'test_tunnel_kern'
> >
> > libbpf: failed to load BPF skeleton 'test_tunnel_kern': -22
> >
> > test_ip6vxlan_tunnel:FAIL:test_tunnel_kern__open_and_load unexpected error: -22
> >
> > serial_test_tunnel:PASS:pthread_join 0 nsec
> >
> > #198/2 tunnel/ip6vxlan_tunnel:FAIL
> >
> > #198 tunnel:FAIL
> >
> > Summary: 0/0 PASSED, 0 SKIPPED, 1 FAILED
> >
>
>
next prev parent reply other threads:[~2022-05-23 8:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-19 15:25 libbpf: failed to load program 'vxlan_get_tunnel_src' Vincent Li
2022-05-20 23:57 ` Andrii Nakryiko
2022-05-23 8:11 ` Shung-Hsi Yu
2022-05-23 8:18 ` Shung-Hsi Yu [this message]
2022-05-23 15:21 ` Vincent Li
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=YotDQtN4qhqBVi22@syu-laptop \
--to=shung-hsi.yu@suse.com \
--cc=bpf@vger.kernel.org \
--cc=vincent.mc.li@gmail.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