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]
Message-ID: <CAEf4BzbYZAsNkVkYddws7inyFkFGmwkQ9Yb0G2hUdw_5Kufgaw@mail.gmail.com>
Date:   Mon, 22 Apr 2019 21:06:07 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Daniel Borkmann <daniel@...earbox.net>
Cc:     bpf@...r.kernel.org, Networking <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Joe Stringer <joe@...d.net.nz>, Yonghong Song <yhs@...com>,
        Martin Lau <kafai@...com>, Jann Horn <jannh@...gle.com>,
        Andrey Ignatov <rdna@...com>
Subject: Re: [PATCH bpf-next v6 11/16] bpf, libbpf: support global
 data/bss/rodata sections

On Mon, Apr 22, 2019 at 5:58 PM Daniel Borkmann <daniel@...earbox.net> wrote:
>
> On 04/19/2019 03:18 AM, Andrii Nakryiko wrote:
> > On Tue, Apr 9, 2019 at 2:20 PM Daniel Borkmann <daniel@...earbox.net> wrote:
> >>
> [...]
> >> +       def->type = BPF_MAP_TYPE_ARRAY;
> >> +       def->key_size = sizeof(int);
> >> +       def->value_size = data->d_size;
> >> +       def->max_entries = 1;
> >> +       def->map_flags = type == LIBBPF_MAP_RODATA ?
> >> +                        BPF_F_RDONLY_PROG : 0;
> >
> > This is breaking BPF programs (even those that don't use global data,
> > as they still have .rodata section, though I haven't investigated its
> > contents) on kernels that don't yet support BPF_F_RDONLY_PROG flag
> > yet. We probably need to probe support for that flag first, before
> > using it. Just giving heads up, as I just discovered it trying to sync
> > libbpf on github.
>
> Thanks for reporting! On a quick look test_progs (modulo global data test)
> seems to pass with an slightly older kernel. I'll retry with a latest LLVM git
> tree tomorrow with our test suite. Did you see a specific one failing or do you
> have a reproducer in case it's something not covered where I could look into?

You need to add something like this to trigger .rodata section
generation (BPF code doesn't have to use that struct, it just needs to
be present):

const struct { int x, y; } bla = {};

This will cause libbpf to create a map for .rodata and specify
BPF_F_RDONLY_PROG flag, which on older kernels will be rejected.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ