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: <CAJ8uoz38HYgHYPHCZ2fJ_GisgaT47sr+bcvHj=7s8dZdEgUDQQ@mail.gmail.com>
Date:   Wed, 25 Nov 2020 07:55:35 +0100
From:   Magnus Karlsson <magnus.karlsson@...il.com>
To:     Björn Töpel <bjorn.topel@...il.com>
Cc:     Network Development <netdev@...r.kernel.org>,
        bpf <bpf@...r.kernel.org>,
        Björn Töpel <bjorn.topel@...el.com>,
        "Karlsson, Magnus" <magnus.karlsson@...el.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        "Fijalkowski, Maciej" <maciej.fijalkowski@...el.com>,
        "Samudrala, Sridhar" <sridhar.samudrala@...el.com>,
        "Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
        "Zhang, Qi Z" <qi.z.zhang@...el.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Eric Dumazet <edumazet@...gle.com>,
        Jonathan Lemon <jonathan.lemon@...il.com>,
        Maxim Mikityanskiy <maximmi@...dia.com>
Subject: Re: [PATCH bpf-next v3 03/10] xsk: add support for recvmsg()

On Thu, Nov 19, 2020 at 9:32 AM Björn Töpel <bjorn.topel@...il.com> wrote:
>
> From: Björn Töpel <bjorn.topel@...el.com>
>
> Add support for non-blocking recvmsg() to XDP sockets. Previously,
> only sendmsg() was supported by XDP socket. Now, for symmetry and the
> upcoming busy-polling support, recvmsg() is added.
>
> Signed-off-by: Björn Töpel <bjorn.topel@...el.com>
> ---
>  net/xdp/xsk.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)

Acked-by: Magnus Karlsson <magnus.karlsson@...el.com>

> diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
> index b0141973f23e..56a52ec75696 100644
> --- a/net/xdp/xsk.c
> +++ b/net/xdp/xsk.c
> @@ -531,6 +531,26 @@ static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len)
>         return __xsk_sendmsg(sk);
>  }
>
> +static int xsk_recvmsg(struct socket *sock, struct msghdr *m, size_t len, int flags)
> +{
> +       bool need_wait = !(flags & MSG_DONTWAIT);
> +       struct sock *sk = sock->sk;
> +       struct xdp_sock *xs = xdp_sk(sk);
> +
> +       if (unlikely(!(xs->dev->flags & IFF_UP)))
> +               return -ENETDOWN;
> +       if (unlikely(!xs->rx))
> +               return -ENOBUFS;
> +       if (unlikely(!xsk_is_bound(xs)))
> +               return -ENXIO;
> +       if (unlikely(need_wait))
> +               return -EOPNOTSUPP;
> +
> +       if (xs->pool->cached_need_wakeup & XDP_WAKEUP_RX && xs->zc)
> +               return xsk_wakeup(xs, XDP_WAKEUP_RX);
> +       return 0;
> +}
> +
>  static __poll_t xsk_poll(struct file *file, struct socket *sock,
>                              struct poll_table_struct *wait)
>  {
> @@ -1191,7 +1211,7 @@ static const struct proto_ops xsk_proto_ops = {
>         .setsockopt     = xsk_setsockopt,
>         .getsockopt     = xsk_getsockopt,
>         .sendmsg        = xsk_sendmsg,
> -       .recvmsg        = sock_no_recvmsg,
> +       .recvmsg        = xsk_recvmsg,
>         .mmap           = xsk_mmap,
>         .sendpage       = sock_no_sendpage,
>  };
> --
> 2.27.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ