lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 29 Mar 2021 13:16:47 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc:     Andrii Nakryiko <andrii@...nel.org>, bpf <bpf@...r.kernel.org>,
        Networking <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v4 bpf-next 07/12] libbpf: add BPF static linker BTF and
 BTF.ext support

On Sun, Mar 28, 2021 at 11:29:27AM -0700, Andrii Nakryiko wrote:
> On Sun, Mar 28, 2021 at 5:03 AM Jiri Olsa <jolsa@...hat.com> wrote:
> >
> > On Fri, Mar 19, 2021 at 07:58:13PM +0100, Jiri Olsa wrote:
> > > On Fri, Mar 19, 2021 at 11:39:01AM -0700, Andrii Nakryiko wrote:
> > > > On Fri, Mar 19, 2021 at 9:23 AM Jiri Olsa <jolsa@...hat.com> wrote:
> > > > >
> > > > > On Thu, Mar 18, 2021 at 12:40:31PM -0700, Andrii Nakryiko wrote:
> > > > >
> > > > > SNIP
> > > > >
> > > > > > +
> > > > > > +     return NULL;
> > > > > > +}
> > > > > > +
> > > > > > +static int linker_fixup_btf(struct src_obj *obj)
> > > > > > +{
> > > > > > +     const char *sec_name;
> > > > > > +     struct src_sec *sec;
> > > > > > +     int i, j, n, m;
> > > > > > +
> > > > > > +     n = btf__get_nr_types(obj->btf);
> > > > >
> > > > > hi,
> > > > > I'm getting bpftool crash when building tests,
> > > > >
> > > > > looks like above obj->btf can be NULL:
> > > >
> > > > I lost if (!obj->btf) return 0; somewhere along the rebases. I'll send
> > > > a fix shortly. But how did you end up with selftests BPF objects built
> > > > without BTF?
> > >
> > > no idea.. I haven't even updated llvm for almost 3 days now ;-)
> >
> > sorry for late follow up on this, and it's actually forgotten empty
> > object in progs directory that was causing this
> >
> > I wonder we should add empty object like below to catch these cases,
> 
> well, feel free to chime in on [0] then
> 
>   [0] https://patchwork.kernel.org/project/netdevbpf/patch/20210319205909.1748642-4-andrii@kernel.org/

right, well this would be added to catch similar crashes,
which I think you both agree on

> 
> > because there's another place that bpftool is crashing on with it
> >
> > I can send full patch for that if you think it's worth having
> 
> sure, but see my comment below

ok, thanks
jirka

> 
> >
> > jirka
> >
> >
> > ---
> > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> > index 7aad78dbb4b4..aecb6ca52bce 100644
> > --- a/tools/lib/bpf/libbpf.c
> > +++ b/tools/lib/bpf/libbpf.c
> > @@ -3165,6 +3165,9 @@ static int add_dummy_ksym_var(struct btf *btf)
> >         const struct btf_var_secinfo *vs;
> >         const struct btf_type *sec;
> >
> > +       if (!btf)
> > +               return 0;
> > +
> 
> add_dummy_ksym_var() shouldn't be called, if there is no btf, so the
> fix should be outside of this fix.
> 
> >         sec_btf_id = btf__find_by_name_kind(btf, KSYMS_SEC,
> >                                             BTF_KIND_DATASEC);
> >         if (sec_btf_id < 0)
> > diff --git a/tools/testing/selftests/bpf/progs/empty.c b/tools/testing/selftests/bpf/progs/empty.c
> > new file mode 100644
> > index 000000000000..e69de29bb2d1
> >
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ