From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
wireguard@lists.zx2c4.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
syzbot+de9701a2cad597c14d34@syzkaller.appspotmail.com
Subject: Re: [PATCH net] wireguard: mark racy persistent_keepalive_interval accesses
Date: Tue, 10 Nov 2026 17:20:28 +0100 [thread overview]
Message-ID: <avNETK_9e7sr-JSB@zx2c4.com> (raw)
In-Reply-To: <20261011102322.355167-1-ngocthang2710.1999@gmail.com>
On Sun, Oct 11, 2026 at 05:23:22PM +0700, Nguyen Ngoc Thang wrote:
> wg_set_device_doit() updates peer->persistent_keepalive_interval under
> device_update_lock, while the RX/TX paths read it locklessly in
> wg_timers_any_authenticated_packet_traversal() and in the persistent
> keepalive timer. KCSAN reports the race:
>
> BUG: KCSAN: data-race in set_peer / wg_timers_any_authenticated_packet_traversal
>
> write to ... by task 3648 on cpu 1:
> set_peer+0x... drivers/net/wireguard/netlink.c:457
> wg_set_device_doit+0x...
> read to ... by task 3652 on cpu 0:
> wg_timers_any_authenticated_packet_traversal+0x... timers.c:217
> wg_packet_consume_data_done+0x...
> wg_packet_rx_poll+0x...
>
> The race is benign, but the reader also loads the field twice, so the
> zero check and the timer expiry computation can see different values.
> Load it once with READ_ONCE() and mark the writer and the other
> lockless reader accordingly.
Applied, thank you!
prev parent reply other threads:[~2026-11-10 16:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 10:23 [PATCH net] wireguard: mark racy persistent_keepalive_interval accesses Nguyen Ngoc Thang
2026-11-10 16:20 ` Jason A. Donenfeld [this message]
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=avNETK_9e7sr-JSB@zx2c4.com \
--to=jason@zx2c4.com \
--cc=andrew+netdev@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=ngocthang2710.1999@gmail.com \
--cc=pabeni@redhat.com \
--cc=syzbot+de9701a2cad597c14d34@syzkaller.appspotmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.