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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 15 Feb 2022 17:56:36 -0500
From:   Mauricio Vásquez Bernal <mauricio@...volk.io>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc:     Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Quentin Monnet <quentin@...valent.com>,
        Rafael David Tinoco <rafaeldtinoco@...il.com>,
        Lorenzo Fontana <lorenzo.fontana@...stic.co>,
        Leonardo Di Donato <leonardo.didonato@...stic.co>
Subject: Re: [PATCH bpf-next v6 6/7] bpftool: gen min_core_btf explanation and examples

On Fri, Feb 11, 2022 at 7:42 PM Andrii Nakryiko
<andrii.nakryiko@...il.com> wrote:
>
> On Wed, Feb 9, 2022 at 2:27 PM Mauricio Vásquez <mauricio@...volk.io> wrote:
> >
> > From: Rafael David Tinoco <rafaeldtinoco@...il.com>
> >
> > Add "min_core_btf" feature explanation and one example of how to use it
> > to bpftool-gen man page.
> >
> > Signed-off-by: Mauricio Vásquez <mauricio@...volk.io>
> > Signed-off-by: Rafael David Tinoco <rafael.tinoco@...asec.com>
> > Signed-off-by: Lorenzo Fontana <lorenzo.fontana@...stic.co>
> > Signed-off-by: Leonardo Di Donato <leonardo.didonato@...stic.co>
> > ---
> >  .../bpf/bpftool/Documentation/bpftool-gen.rst | 93 +++++++++++++++++++
> >  1 file changed, 93 insertions(+)
> >
>
> [...]
>
> > +Now, the "5.4.0-smaller.btf" file may be used by libbpf as an external BTF file
> > +when loading the "one.bpf.o" object into the "5.4.0-example" kernel. Note that
> > +the generated BTF file won't allow other eBPF objects to be loaded, just the
> > +ones given to min_core_btf.
> > +
> > +::
> > +
> > +  struct bpf_object *obj = NULL;
> > +  struct bpf_object_open_opts openopts = {};
> > +
> > +  openopts.sz = sizeof(struct bpf_object_open_opts);
> > +  openopts.btf_custom_path = "./5.4.0-smaller.btf";
> > +
> > +  obj = bpf_object__open_file("./one.bpf.o", &openopts);
>
> Can you please use LIBBPF_OPTS() macro in the example, that's how
> users are normally expected to use OPTS-based APIs anyways. Also there
> is no need for "./" when specifying file location. This is a different
> case than running a binary in the shell, where binary is searched in
> PATH. This is never done when opening files.
>
> So all this should be:
>
> LIBBPF_OPTS(bpf_object_open_opts, opts, .btf_custom_path = "5.4.0-smaller.btf");
> struct bpf_object *obj;
>

I suppose you meant DECLARE_LIBBPF_OPTS(...)

> obj = bpf_object__open_file("one.bpf.o", &opts);
>
> That's all.
>
>
> > +
> > +  ...
> > --
> > 2.25.1
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ