From: Alexander Ildiyarov <alex@badcode.im>
To: "Jason A . Donenfeld" <Jason@zx2c4.com>,
wireguard@lists.zx2c4.com, netdev@vger.kernel.org
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org,
Alexander Ildiyarov <alex@badcode.im>
Subject: [PATCH net 0/2] wireguard: memcg accounting and initiation race fix
Date: Thu, 5 Nov 2026 17:10:04 +0300 [thread overview]
Message-ID: <20261105141006.95083-1-alex@badcode.im> (raw)
Two independent fixes:
1/2 charges peer, allowedips, dst_cache and hashtable allocations to the
memcg of the configuring process, which currently can allocate
unaccounted kernel memory through WG_CMD_SET_DEVICE.
2/2 rechecks the replay/flood conditions under the write lock in
wg_noise_handshake_consume_initiation(), the initiation-side counterpart
of 2a73c9b2c0ca. The race window is narrow and was only reproduced with
an artificial delay; details are in the commit message.
Tested in qemu (x86_64, 4 vCPUs) with reproducers for both issues and
CONFIG_WIREGUARD_DEBUG self-tests. netns.sh was run up to the
allowed-ips removal step, where the available wg(8) is too old; that
part was not run.
Alexander Ildiyarov (2):
wireguard: account peer and allowedips allocations to memcg
wireguard: noise: recheck replay and flood under write lock on
initiation
drivers/net/wireguard/allowedips.c | 2 +-
drivers/net/wireguard/noise.c | 29 ++++++++++++++++++++++-------
drivers/net/wireguard/peer.c | 4 ++--
drivers/net/wireguard/peerlookup.c | 4 ++--
4 files changed, 27 insertions(+), 12 deletions(-)
--
2.43.0
next reply other threads:[~2026-11-05 14:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 14:10 Alexander Ildiyarov [this message]
2026-11-05 14:10 ` [PATCH net 1/2] wireguard: account peer and allowedips allocations to memcg Alexander Ildiyarov
2026-11-09 15:20 ` netdev-bot+sashiko
2026-11-10 16:57 ` Jason A. Donenfeld
2026-11-10 18:04 ` alex
2026-11-10 18:06 ` Jason A. Donenfeld
2026-11-05 14:10 ` [PATCH net 2/2] wireguard: noise: recheck replay and flood under write lock on initiation Alexander Ildiyarov
2026-11-09 15:20 ` netdev-bot+sashiko
2026-11-05 14:14 ` [PATCH net 0/2] wireguard: memcg accounting and initiation race fix netdev-bot+sinfo
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=20261105141006.95083-1-alex@badcode.im \
--to=alex@badcode.im \
--cc=Jason@zx2c4.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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.