[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEf4BzZuqPLJ=ModfYqKpU6bDMqZpt_NfDZyPTCOp=Ws0MnAhA@mail.gmail.com>
Date: Wed, 7 Aug 2019 15:25:40 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>,
Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Yonghong Song <yhs@...com>, Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v6 bpf-next 04/14] libbpf: implement BPF CO-RE offset
relocation algorithm
On Wed, Aug 7, 2019 at 3:16 PM Alexei Starovoitov
<alexei.starovoitov@...il.com> wrote:
>
> On Wed, Aug 07, 2019 at 02:39:51PM -0700, Andrii Nakryiko wrote:
> > This patch implements the core logic for BPF CO-RE offsets relocations.
> > Every instruction that needs to be relocated has corresponding
> > bpf_offset_reloc as part of BTF.ext. Relocations are performed by trying
> > to match recorded "local" relocation spec against potentially many
> > compatible "target" types, creating corresponding spec. Details of the
> > algorithm are noted in corresponding comments in the code.
> >
> > Signed-off-by: Andrii Nakryiko <andriin@...com>
> > Acked-by: Song Liu <songliubraving@...com>
> ...
> > +static struct btf *bpf_core_find_kernel_btf(void)
> > +{
> > + const char *locations[] = {
> > + "/lib/modules/%1$s/vmlinux-%1$s",
> > + "/usr/lib/modules/%1$s/kernel/vmlinux",
> > + };
>
> the vmlinux finding logic didn't work out of the box for me.
> My vmlinux didn't have -`uname -r` suffix.
> Probably worth adding /boot/vmlinux-uname too.
Yeah, there doesn't appear to be a consensus about standard location.
For completeness, I'll add a set of paths perf is using in follow-up
patch. But overall this mess with searching for vmlinux is one of
motivational factors for https://patchwork.ozlabs.org/patch/1143622/,
which should fix this problem.
> May be vmlinuz can have BTF as well?
Probably, but it might be too expensive to extract it? Either way,
once .BTF is loadable inside kernel, there won't be a need to search
for vmlinux/vmlinux location.
>
> Overall looks great. Applied to bpf-next. Thanks!
>
Thanks!
Powered by blists - more mailing lists