[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJRXjYTojFyHN6s1Qu9Vkkk6RwxPF=bAKPjOg9zT-GupA@mail.gmail.com>
Date: Sat, 9 Mar 2024 14:50:59 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: linke li <lilinke99@...com>
Cc: "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Kuniyuki Iwashima <kuniyu@...zon.com>,
Willem de Bruijn <willemb@...gle.com>, Abel Wu <wuyun.abel@...edance.com>,
Breno Leitao <leitao@...ian.org>, Alexander Mikhalitsyn <alexander@...alicyn.com>,
David Howells <dhowells@...hat.com>, netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: mark racy access on sk->sk_rcvbuf
On Sat, Mar 9, 2024 at 2:35 PM linke li <lilinke99@...com> wrote:
>
> sk->sk_rcvbuf can be changed by other threads. Mark this as benign using
> READ_ONCE.
>
> This patch is aimed at reducing the number of benign races reported by
> KCSAN in order to focus future debugging effort on harmful races.
>
> Signed-off-by: linke li <lilinke99@...com>
> ---
> net/core/sock.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/sock.c b/net/core/sock.c
> index 5e78798456fd..4c5524e70534 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -551,7 +551,7 @@ int __sk_receive_skb(struct sock *sk, struct sk_buff *skb,
>
> skb->dev = NULL;
>
> - if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
> + if (sk_rcvqueues_full(sk, READ_ONCE(sk->sk_rcvbuf))) {
> atomic_inc(&sk->sk_drops);
> goto discard_and_relse;
OK, but what about __sock_queue_rcv_skb() in the same file ?
Powered by blists - more mailing lists