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: <CANn89i+5+OhOg2t6oFuiDo3QXQy6nkYMCPaqZuhHyH0E+wVREA@mail.gmail.com>
Date: Fri, 22 Aug 2025 06:30:39 -0700
From: Eric Dumazet <edumazet@...gle.com>
To: Neal Cardwell <ncardwell@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, 
	Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>, 
	Kuniyuki Iwashima <kuniyu@...gle.com>, netdev@...r.kernel.org, eric.dumazet@...il.com
Subject: Re: [PATCH net-next 2/2] tcp: annotate data-races around icsk->icsk_probes_out

On Fri, Aug 22, 2025 at 6:22 AM Neal Cardwell <ncardwell@...gle.com> wrote:
>
> On Fri, Aug 22, 2025 at 5:17 AM Eric Dumazet <edumazet@...gle.com> wrote:
> >
> > icsk->icsk_probes_out is read locklessly from inet_sk_diag_fill(),
> > get_tcp4_sock() and get_tcp6_sock().
> >
> > Add corresponding READ_ONCE()/WRITE_ONCE() annotations.
> >
> > Signed-off-by: Eric Dumazet <edumazet@...gle.com>
>
> > +       WRITE_ONCE(icsk->icsk_probes_out, icsk->icsk_probes_out + 1);
>
> > +                       WRITE_ONCE(icsk->icsk_probes_out, icsk->icsk_probes_out + 1);
>
> Do we want a READ_ONCE as well for those 2 cases? Like:
>
> WRITE_ONCE(icsk->icsk_probes_out, READ_ONCE (icsk->icsk_probes_out) + 1);
>

READ_ONCE() here is not needed, because we own the socket lock.


> Perhaps it's not strictly necessary, though I see several places in
> the code base that use this approach for increments...

Maybe in contexts where the read can conflict with another parallel write

__inet_hash_connect
...
WRITE_ONCE(table_perturb[index], READ_ONCE(table_perturb[index]) + i + step);

In this case, we do not own a lock on table_perturb[index]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ