From: "Theodore Tso" <tytso@mit.edu>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Rafael Passos <rafael@rcpassos.me>,
Jason@zx2c4.com, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
pabeni@redhat.com,
syzbot+9ca7674fa7521a3f1bc2@syzkaller.appspotmail.com,
syzkaller-bugs@googlegroups.com, wireguard@lists.zx2c4.com
Subject: Re: [PATCH] Wireguard: Fix data-race in rx/tx counter
Date: Sun, 28 Jun 2026 22:34:17 -0400 [thread overview]
Message-ID: <akHY4UEa1ab2PF-j@mit.edu> (raw)
In-Reply-To: <aa423184-7465-4bc9-aff4-d3d671beb3c6@lunn.ch>
On Sun, Jun 28, 2026 at 11:02:05PM -0500, Andrew Lunn wrote:
> On Sun, Jun 28, 2026 at 05:38:23PM -0300, Rafael Passos wrote:
> > fixes data-race in {rx/tx}_bytes counter for wireguard connection.
> > these values were incremented inside a read_lock_bh block, but write
> > protections were missing. making them atomic was the simplest way out.
> > This was found by syzbot with kcsan.
>
> Atomics are expensive in general, especially on high CPU count
> systems.
>
> Statistic counters tend to be very asymmetric in usage. They are
> incremented frequently, maybe per packet, but reported very
> infrequently, maybe every minute when an SNMP agent reads them.
One of the reasons why kcsan and syzbot can be quite noisy is that a
human being needs to *think* and consider whether or not this is
actually important. (One of the reasons why I'm not all that worried
about our new AI overlords taking over the world. :-) Consider what
is the worst that might happen if the tx/rx_bytes counter might not be
completely accurate? Is it worth the performance penalty of using
atomics (or the memory overhead of per-CPU counters)?
- Ted
next prev parent reply other threads:[~2026-06-29 2:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 14:33 [syzbot] [wireguard?] KCSAN: data-race in wg_socket_send_skb_to_peer / wg_socket_send_skb_to_peer (9) syzbot
2026-06-22 19:34 ` Rafael Passos
2026-06-28 20:38 ` [PATCH] Wireguard: Fix data-race in rx/tx counter Rafael Passos
2026-06-28 21:02 ` Andrew Lunn
2026-06-29 2:34 ` Theodore Tso [this message]
2026-06-29 3:05 ` Rafael Passos
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=akHY4UEa1ab2PF-j@mit.edu \
--to=tytso@mit.edu \
--cc=Jason@zx2c4.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rafael@rcpassos.me \
--cc=syzbot+9ca7674fa7521a3f1bc2@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=wireguard@lists.zx2c4.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox