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: <CANn89iLtRYt6U+q_VHb_3Vj2ydmnwsSon4uwPX3+yTJDgoDenQ@mail.gmail.com>
Date: Fri, 8 Mar 2024 13:51:35 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Jason Xing <kerneljasonxing@...il.com>
Cc: dsahern@...nel.org, matttbe@...nel.org, martineau@...nel.org, 
	geliang@...nel.org, kuba@...nel.org, pabeni@...hat.com, davem@...emloft.net, 
	mptcp@...ts.linux.dev, netdev@...r.kernel.org, 
	Jason Xing <kernelxing@...cent.com>
Subject: Re: [PATCH net-next 2/2] tcp: annotate a data-race around sysctl_tcp_wmem[0]

On Fri, Mar 8, 2024 at 12:25 PM Jason Xing <kerneljasonxing@...il.com> wrote:
>
> From: Jason Xing <kernelxing@...cent.com>
>
> When reading wmem[0], it could be changed concurrently without
> READ_ONCE() protection. So add one annotation here.
>
> Signed-off-by: Jason Xing <kernelxing@...cent.com>
> ---
>  net/ipv4/tcp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index c5b83875411a..e3904c006e63 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -975,7 +975,7 @@ int tcp_wmem_schedule(struct sock *sk, int copy)
>          * Use whatever is left in sk->sk_forward_alloc and tcp_wmem[0]
>          * to guarantee some progress.
>          */
> -       left = sock_net(sk)->ipv4.sysctl_tcp_wmem[0] - sk->sk_wmem_queued;
> +       left = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[0]) - sk->sk_wmem_queued;

SGTM, you could have split the long line...

Reviewed-by: Eric Dumazet <edumazet@...gle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ