On Wed, Aug 7, 2019 at 3:16 PM Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> 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@xxxxxx> > > Acked-by: Song Liu <songliubraving@xxxxxx> > ... > > +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!