All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Cong Wang <xiyou.wangcong@gmail.com>, netdev@vger.kernel.org
Cc: bpf@vger.kernel.org, Cong Wang <cong.wang@bytedance.com>,
	Yucong Sun <sunyucong@gmail.com>,
	John Fastabend <john.fastabend@gmail.com>,
	Jakub Sitnicki <jakub@cloudflare.com>,
	Lorenz Bauer <lmb@cloudflare.com>
Subject: Re: [Patch bpf v3 3/4] net: implement ->sock_is_readable() for UDP and AF_UNIX
Date: Thu, 7 Oct 2021 22:00:24 +0200	[thread overview]
Message-ID: <582ff8e9-c7b7-88c1-6cf0-e143da92836f@iogearbox.net> (raw)
In-Reply-To: <20211002003706.11237-4-xiyou.wangcong@gmail.com>

On 10/2/21 2:37 AM, Cong Wang wrote:
> From: Cong Wang <cong.wang@bytedance.com>
> 
> Yucong noticed we can't poll() sockets in sockmap even
> when they are the destination sockets of redirections.
> This is because we never poll any psock queues in ->poll(),
> except for TCP. With ->sock_is_readable() now we can
> overwrite >sock_is_readable(), invoke and implement it for
> both UDP and AF_UNIX sockets.
> 
> Reported-by: Yucong Sun <sunyucong@gmail.com>
> Cc: John Fastabend <john.fastabend@gmail.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Jakub Sitnicki <jakub@cloudflare.com>
> Cc: Lorenz Bauer <lmb@cloudflare.com>
> Signed-off-by: Cong Wang <cong.wang@bytedance.com>
> ---
>   net/ipv4/udp.c      | 2 ++
>   net/ipv4/udp_bpf.c  | 1 +
>   net/unix/af_unix.c  | 4 ++++
>   net/unix/unix_bpf.c | 2 ++
>   4 files changed, 9 insertions(+)
> 
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 2a7825a5b842..4a7e15a43a68 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -2866,6 +2866,8 @@ __poll_t udp_poll(struct file *file, struct socket *sock, poll_table *wait)
>   	    !(sk->sk_shutdown & RCV_SHUTDOWN) && first_packet_length(sk) == -1)
>   		mask &= ~(EPOLLIN | EPOLLRDNORM);
>   
> +	if (sk_is_readable(sk))
> +		mask |= EPOLLIN | EPOLLRDNORM;

udp_poll() has this extra logic around first_packet_length() which drops all bad csum'ed
skbs. How does this stand in relation to sk_msg_is_readable()? Is this a concern as well
there? Maybe makes sense to elaborate a bit more in the commit message for context / future
reference.

Thanks,
Daniel

>   	return mask;
>   
>   }



  reply	other threads:[~2021-10-07 20:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-02  0:37 [Patch bpf v3 0/4] sock_map: fix ->poll() and update selftests Cong Wang
2021-10-02  0:37 ` [Patch bpf v3 1/4] net: rename ->stream_memory_read to ->sock_is_readable Cong Wang
2021-10-02  0:37 ` [Patch bpf v3 2/4] skmsg: extract and reuse sk_msg_is_readable() Cong Wang
2021-10-02  0:37 ` [Patch bpf v3 3/4] net: implement ->sock_is_readable() for UDP and AF_UNIX Cong Wang
2021-10-07 20:00   ` Daniel Borkmann [this message]
2021-10-07 20:53     ` Cong Wang
2021-10-08 15:26       ` John Fastabend
2021-10-02  0:37 ` [Patch bpf v3 4/4] selftests/bpf: use recv_timeout() instead of retries Cong Wang
2021-10-06 15:24 ` [Patch bpf v3 0/4] sock_map: fix ->poll() and update selftests John Fastabend

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=582ff8e9-c7b7-88c1-6cf0-e143da92836f@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=bpf@vger.kernel.org \
    --cc=cong.wang@bytedance.com \
    --cc=jakub@cloudflare.com \
    --cc=john.fastabend@gmail.com \
    --cc=lmb@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=sunyucong@gmail.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.