[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260118002427.1037338-2-kuba@kernel.org>
Date: Sat, 17 Jan 2026 16:24:28 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: dhowells@...hat.com
Cc: Jakub Kicinski <kuba@...nel.org>,
netdev@...r.kernel.org
Subject: Re: [net,v2] rxrpc: Fix data-race warning and potential load/store tearing
Hi,
This is an AI-generated review of your patch.
Bit of a nit pick but... I guess so..?
For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
rxrpc: Fix data-race warning and potential load/store tearing
This commit fixes a KCSAN data-race warning on peer->last_tx_at by changing
it from time64_t to unsigned int (to prevent tearing on 32-bit) and adding
WRITE_ONCE/READ_ONCE annotations for the accesses.
Closes: https://lore.kernel.org/r/695e7cfb.050a0220.1c677c.036b.GAE@google.com/
> diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c
> index 7f4729234957..9d02448ac062 100644
[ ... ]
> +static time64_t rxrpc_peer_get_tx_mark(const struct rxrpc_peer *peer, time64_t base)
> +{
> + s32 last_tx_at = READ_ONCE(peer->last_tx_at);
[ ... ]
> diff --git a/net/rxrpc/proc.c b/net/rxrpc/proc.c
> index d803562ca0ac..ce4fd1af79ba 100644
> --- a/net/rxrpc/proc.c
> +++ b/net/rxrpc/proc.c
> @@ -296,13 +296,13 @@ static int rxrpc_peer_seq_show(struct seq_file *seq, void *v)
>
> now = ktime_get_seconds();
> seq_printf(seq,
> - "UDP %-47.47s %-47.47s %3u %4u %5u %6llus %8d %8d\n",
> + "UDP %-47.47s %-47.47s %3u %4u %5u %6ds %8d %8d\n",
> lbuff,
> rbuff,
> refcount_read(&peer->ref),
> peer->cong_ssthresh,
> peer->max_data,
> - now - peer->last_tx_at,
> + (s32)now - (s32)peer->last_tx_at,
^^^^^^^^^^^^^^^^^
Should this read use READ_ONCE(peer->last_tx_at) for consistency with the
data-race fix? The new rxrpc_peer_get_tx_mark() uses READ_ONCE for the
same field, and the same seq_printf uses READ_ONCE for recent_srtt_us and
recent_rto_us on the following lines.
> + READ_ONCE(peer->recent_srtt_us),
> + READ_ONCE(peer->recent_rto_us));
--
pw-bot: cr
Powered by blists - more mailing lists