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]
Message-ID: <CAEf4BzY0cxs02=jx3KJ-jvVWsCKz-x=oJCfw94a1SdO=WMd0VA@mail.gmail.com>
Date:   Fri, 21 Jan 2022 13:35:19 -0800
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Mauricio Vásquez Bernal <mauricio@...volk.io>
Cc:     Quentin Monnet <quentin@...valent.com>,
        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>,
        Rafael David Tinoco <rafaeldtinoco@...il.com>,
        Lorenzo Fontana <lorenzo.fontana@...stic.co>,
        Leonardo Di Donato <leonardo.didonato@...stic.co>
Subject: Re: [PATCH bpf-next v4 3/8] bpftool: Add gen btf command

On Fri, Jan 21, 2022 at 12:40 PM Mauricio Vásquez Bernal
<mauricio@...volk.io> wrote:
>
> On Wed, Jan 12, 2022 at 1:08 PM Quentin Monnet <quentin@...valent.com> wrote:
> >
> > 2022-01-12 09:27 UTC-0500 ~ Mauricio Vásquez <mauricio@...volk.io>
> > > This command is implemented under the "gen" command in bpftool and the
> > > syntax is the following:
> > >
> > > $ bpftool gen btf INPUT OUTPUT OBJECT(S)
> >
> > Thanks a lot for this work!
> >
> > Please update the relevant manual page under Documentation, to let users
> > know how to use the feature. You may also consider adding an example at
> > the end of that document.
> >
>
> We're working on it, and will be part of the next spin.
>
> > The bash completion script should also be updated with the new "btf"
> > subcommand for "gen". Given that all the arguments are directories and
> > files, it should not be hard.
> >
>
> Will do.
>
> > Have you considered adding tests for the feature? There are a few
> > bpftool-related selftests under tools/testing/selftests/bpf/.
> >
>
> Yes, we have but it seems not that trivial. One idea I have is to
> include a couple of BTF source files from
> https://github.com/aquasecurity/btfhub-archive/ and create a test
> program that generates some field, type and enum relocations. Then we
> could check if the generated BTF file has the expected types, fields
> and so on by parsing it and using the BTF API from libbpf. One concern
> about it is the size of those two source BTF files (~5MB each),
> perhaps we should not include a full file but something that is
> already "trimmed"? Another possibility is to use
> "/sys/kernel/btf/vmlinux" but it'll limit the test to machines with
> CONFIG_DEBUG_INFO_BTF.
>
> Do you have any ideas / feedback on this one? Should the tests be
> included in this series or can we push them later on?

See how we test CO-RE relocations and how we use C files to get custom
BTFs. See progs/btf_* and prog_tests/core_reloc.c selftests. You don't
have to use real vmlinux BTF to test this functionality.


>
> > >
> > > INPUT can be either a single BTF file or a folder containing BTF files,
> > > when it's a folder, a BTF file is generated for each BTF file contained
> > > in this folder. OUTPUT is the file (or folder) where generated files are
> > > stored and OBJECT(S) is the list of bpf objects we want to generate the
> > > BTF file(s) for (each generated BTF file contains all the types needed
> > > by all the objects).
> > >
> > > 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>
> > > ---
> > >  tools/bpf/bpftool/gen.c | 117 ++++++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 117 insertions(+)
> > >

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ