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]
Date:   Mon, 21 Oct 2019 07:03:25 +0200
From:   Björn Töpel <bjorn.topel@...il.com>
To:     Toke Høiland-Jørgensen <toke@...hat.com>
Cc:     Netdev <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Björn Töpel <bjorn.topel@...el.com>,
        bpf <bpf@...r.kernel.org>,
        Magnus Karlsson <magnus.karlsson@...il.com>,
        "Karlsson, Magnus" <magnus.karlsson@...el.com>,
        "Samudrala, Sridhar" <sridhar.samudrala@...el.com>
Subject: Re: [PATCH bpf-next] libbpf: remove explicit XSKMAP lookup from
 AF_XDP XDP program

On Sun, 20 Oct 2019 at 21:53, Toke Høiland-Jørgensen <toke@...hat.com> wrote:
>
> Björn Töpel <bjorn.topel@...il.com> writes:
>
> > From: Björn Töpel <bjorn.topel@...el.com>
> >
> > In commit 43e74c0267a3 ("bpf_xdp_redirect_map: Perform map lookup in
> > eBPF helper") the bpf_redirect_map() helper learned to do map lookup,
> > which means that the explicit lookup in the XDP program for AF_XDP is
> > not needed.
> >
> > This commit removes the map lookup, which simplifies the BPF code and
> > improves the performance for the "rx_drop" [1] scenario with ~4%.
>
> Nice, 4% is pretty good!
>
> I wonder if the program needs to be backwards-compatible (with pre-5.3
> kernels), though?
>
> You can do that by something like this:
>
> ret = bpf_redirect_map(&xsks_map, index, XDP_PASS);
> if (ret > 0)
>   return ret;
>
> if (bpf_map_lookup_elem(&xsks_map, &index))
>    return bpf_redirect_map(&xsks_map, index, 0);
> return XDP_PASS;
>

Ah, yes. Thanks for pointing that out. I'll do a respin.


Thanks,
Björn

>
> This works because bpf_redirect_map() prior to 43e74c0267a3 will return
> XDP_ABORTED on a non-0 flags value.
>
> -Toke
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ