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:   Mon, 28 Oct 2019 11:23:09 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Jesper Dangaard Brouer <brouer@...hat.com>
Cc:     Yonghong Song <yhs@...com>,
        Toke Høiland-Jørgensen <toke@...hat.com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Alexei Starovoitov <ast@...nel.org>, Martin Lau <kafai@...com>,
        Song Liu <songliubraving@...com>,
        David Miller <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        Anton Protopopov <aspsk2@...il.com>
Subject: Re: [PATCH bpf-next v3 4/4] selftests: Add tests for automatic map pinning

On Mon, Oct 28, 2019 at 9:13 AM Jesper Dangaard Brouer
<brouer@...hat.com> wrote:
>
> On Mon, 28 Oct 2019 15:32:26 +0000
> Yonghong Song <yhs@...com> wrote:
>
> > On 10/28/19 6:15 AM, Toke Høiland-Jørgensen wrote:
> > > Jesper Dangaard Brouer <brouer@...hat.com> writes:
> > >
> > >> On Sun, 27 Oct 2019 21:53:19 +0100
> > >> Toke Høiland-Jørgensen <toke@...hat.com> wrote:
> > >>
> > >>> diff --git a/tools/testing/selftests/bpf/progs/test_pinning.c b/tools/testing/selftests/bpf/progs/test_pinning.c
> > >>> new file mode 100644
> > >>> index 000000000000..ff2d7447777e
> > >>> --- /dev/null
> > >>> +++ b/tools/testing/selftests/bpf/progs/test_pinning.c
> > >>> @@ -0,0 +1,29 @@
> > >>> +// SPDX-License-Identifier: GPL-2.0
> > >>> +
> > >>> +#include <linux/bpf.h>
> > >>> +#include "bpf_helpers.h"
> > >>> +
> > >>> +int _version SEC("version") = 1;
> > >>> +
> > >>> +struct {
> > >>> + __uint(type, BPF_MAP_TYPE_ARRAY);
> > >>> + __uint(max_entries, 1);
> > >>> + __type(key, __u32);
> > >>> + __type(value, __u64);
> > >>> + __uint(pinning, LIBBPF_PIN_BY_NAME);
> > >>> +} pinmap SEC(".maps");
> > >>
> > >> So, this is the new BTF-defined maps syntax.
> > >>
> > >> Please remind me, what version of LLVM do we need to compile this?
> > >
> > > No idea what the minimum version is. I'm running LLVM 9.0 :)
> >
> > LLVM 9.0 starts to support .maps.
> > There is no dependency on pahole.
>
> LLVM 9.0.0 is still very new:
>  - 19 September 2019: LLVM 9.0.0 is now available
>
> For my XDP-tutorial[1], I cannot required people to have this new llvm
> version.  But I would like to teach people about this new syntax (note,
> I can upgrade libbpf version via git-submodule, and update bpf_helpers.h).
>
> To Andrii, any recommendations on how I can do the transition?
>
> I'm thinking, it should be possible to define both ELF-object sections
> SEC "maps" and ".maps" at the same time. But how does libbpf handle that?
> (Who takes precedence?)

Yes, libbpf will load both maps and .maps. There is no precedence,
they are treated equally and are just added to the list of maps. But
if there is .maps section without associated BTF, bpf_object__open
will fail (because BTF is mandatory at that point).

>
>
> (Alternatively, I can detect the LLVM version, in the Makefile, and have
> a #ifdef define in the code)
> --
> Best regards,
>   Jesper Dangaard Brouer
>   MSc.CS, Principal Kernel Engineer at Red Hat
>   LinkedIn: http://www.linkedin.com/in/brouer
>
> [1] https://github.com/xdp-project/xdp-tutorial
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ