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:   Wed, 20 Jan 2021 19:30:12 +0100
From:   Björn Töpel <bjorn.topel@...el.com>
To:     Alexei Starovoitov <alexei.starovoitov@...il.com>,
        Andrii Nakryiko <andrii@...nel.org>
Cc:     Toke Høiland-Jørgensen <toke@...hat.com>,
        Björn Töpel <bjorn.topel@...il.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Network Development <netdev@...r.kernel.org>,
        bpf <bpf@...r.kernel.org>,
        "Karlsson, Magnus" <magnus.karlsson@...el.com>,
        "Fijalkowski, Maciej" <maciej.fijalkowski@...el.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Jonathan Lemon <jonathan.lemon@...il.com>, maximmi@...dia.com,
        "David S. Miller" <davem@...emloft.net>,
        Jesper Dangaard Brouer <hawk@...nel.org>,
        John Fastabend <john.fastabend@...il.com>,
        Ciara Loftus <ciara.loftus@...el.com>,
        weqaar.a.janjua@...el.com, Marek Majtyka <alardam@...il.com>
Subject: Re: [PATCH bpf-next v2 5/8] libbpf, xsk: select AF_XDP BPF program
 based on kernel version

On 2021-01-20 19:25, Alexei Starovoitov wrote:
> On Wed, Jan 20, 2021 at 7:27 AM Björn Töpel <bjorn.topel@...el.com> wrote:
>>
>>>> Would it make sense with some kind of BPF-specific "supported
>>>> features" mechanism? Something else with a bigger scope (whole
>>>> kernel)?
>>>
>>> Heh, in my opinion, yeah. Seems like we'll finally get it for XDP, but
>>> for BPF in general the approach has always been probing AFAICT.
>>>
>>> For the particular case of arguments to helpers, I suppose the verifier
>>> could technically validate value ranges for flags arguments, say. That
>>> would be nice as an early reject anyway, but I'm not sure if it is
>>> possible to add after-the-fact without breaking existing programs
>>> because the verifier can't prove the argument is within the valid range.
>>> And of course it doesn't help you with compatibility with
>>> already-released kernels.
>>>
>>
>> Hmm, think I have a way forward. I'll use BPF_PROG_TEST_RUN.
>>
>> If the load fail for the new helper, fallback to bpf_redirect_map(). Use
>> BPF_PROG_TEST_RUN to make sure that "action via flags" passes.
> 
> +1 to Toke's point. No version checks please.
> One way to detect is to try prog_load. Search for FEAT_* in libbpf.
> Another approach is to scan vmlinux BTF for necessary helpers.
> Currently libbpf is relying on the former.
> I think going forward would be good to detect features via BTF.
> It's going to be much faster and won't create noise for audit that
> could be looking at prog_load calls.
> 

Thanks Alexei. I'll explore both options for the next spin!


Björn

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ