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:   Thu, 21 Jan 2021 13:31:19 +0100
From:   Björn Töpel <bjorn.topel@...il.com>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        Björn Töpel <bjorn.topel@...el.com>,
        Magnus Karlsson <magnus.karlsson@...el.com>,
        Maciej Fijalkowski <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 Janjua <weqaar.a.janjua@...el.com>
Subject: Re: [PATCH bpf-next v2 7/8] selftest/bpf: add XDP socket tests for
 bpf_redirect_{xsk, map}()

On Thu, 21 Jan 2021 at 08:39, Andrii Nakryiko <andrii.nakryiko@...il.com> wrote:
>
> On Tue, Jan 19, 2021 at 7:55 AM Björn Töpel <bjorn.topel@...il.com> wrote:
> >
> > From: Björn Töpel <bjorn.topel@...el.com>
> >
> > Add support for externally loaded XDP programs to
> > xdpxceiver/test_xsk.sh, so that bpf_redirect_xsk() and
> > bpf_redirect_map() can be exercised.
> >
> > Signed-off-by: Björn Töpel <bjorn.topel@...el.com>
> > ---
> >  .../selftests/bpf/progs/xdpxceiver_ext1.c     | 15 ++++
> >  .../selftests/bpf/progs/xdpxceiver_ext2.c     |  9 +++
> >  tools/testing/selftests/bpf/test_xsk.sh       | 48 ++++++++++++
> >  tools/testing/selftests/bpf/xdpxceiver.c      | 77 ++++++++++++++++++-
> >  tools/testing/selftests/bpf/xdpxceiver.h      |  2 +
> >  5 files changed, 147 insertions(+), 4 deletions(-)
> >  create mode 100644 tools/testing/selftests/bpf/progs/xdpxceiver_ext1.c
> >  create mode 100644 tools/testing/selftests/bpf/progs/xdpxceiver_ext2.c
> >
> > diff --git a/tools/testing/selftests/bpf/progs/xdpxceiver_ext1.c b/tools/testing/selftests/bpf/progs/xdpxceiver_ext1.c
> > new file mode 100644
> > index 000000000000..18894040cca6
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/progs/xdpxceiver_ext1.c
> > @@ -0,0 +1,15 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +#include <linux/bpf.h>
> > +#include <bpf/bpf_helpers.h>
> > +
> > +struct {
> > +       __uint(type, BPF_MAP_TYPE_XSKMAP);
> > +       __uint(max_entries, 32);
> > +       __uint(key_size, sizeof(int));
> > +       __uint(value_size, sizeof(int));
> > +} xsks_map SEC(".maps");
> > +
> > +SEC("xdp_sock") int xdp_sock_prog(struct xdp_md *ctx)
>
> hmm.. that's unconventional... please keep SEC() on separate line
>
> > +{
> > +       return bpf_redirect_map(&xsks_map, ctx->rx_queue_index, XDP_DROP);
> > +}
> > diff --git a/tools/testing/selftests/bpf/progs/xdpxceiver_ext2.c b/tools/testing/selftests/bpf/progs/xdpxceiver_ext2.c
> > new file mode 100644
> > index 000000000000..bd239b958c01
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/progs/xdpxceiver_ext2.c
> > @@ -0,0 +1,9 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +#include <linux/bpf.h>
> > +#include <bpf/bpf_helpers.h>
> > +
> > +SEC("xdp_sock") int xdp_sock_prog(struct xdp_md *ctx)
>
> same here
>

Thanks Andrii! I'll make sure to have the SECs on separate lines going forward!

Björn

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ