From: Andrii Pasichnyk <apasichnik9@gmail.com>
To: "Jason A . Donenfeld" <Jason@zx2c4.com>
Cc: wireguard@lists.zx2c4.com, netdev@vger.kernel.org,
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>,
Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net v2 0/2] wireguard: free queued packets on peer removal, and test it
Date: Thu, 26 Nov 2026 11:47:20 +0200 [thread overview]
Message-ID: <20261126094722.73025-1-apasichnik9@gmail.com> (raw)
Removing a peer while its receive queue is busy can leave packets on the
per-peer queues. Each of them holds a keypair and a peer reference, so
the peer and the keypair are never freed. Patch 1 frees what is left;
patch 2 adds the test Jason asked for in the v1 thread to netns.sh.
Tested on net e50972666 with the WireGuard selftest VM (x86_64 KVM):
both patches, 4 vCPUs: pass
both patches, NR_CPUS=1: pass
patch 2 only, NR_CPUS=1: fail, 4 peers and 4 keypairs
"merely created" in 10 removals
Changes in v2:
- Patch 1: code unchanged. The reproduction paragraph in the commit
message is corrected: the first reproducer only put load on the first
removal of each run, so "5 in 2140" understated how often this
happens. Under load it is 25-40% of removals with 1 vCPU.
- Patch 2: new, the netns.sh loop from my reply in the v1 thread plus
the larger log buffer it needs.
- Rebased on current net.
v1: https://lore.kernel.org/netdev/20261003201625.4572-1-apasichnik9@gmail.com/
Andrii Pasichnyk (2):
wireguard: peer: free packets left on the per-peer queues on removal
wireguard: selftests: remove a peer under load
drivers/net/wireguard/peer.c | 24 +++++++++++++++++++
tools/testing/selftests/wireguard/netns.sh | 14 +++++++++++
.../selftests/wireguard/qemu/kernel.config | 2 +-
3 files changed, 39 insertions(+), 1 deletion(-)
base-commit: e509726660dd06ce107437aecf7c106c9d3fc1e7
--
2.43.0
next reply other threads:[~2026-11-26 9:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 9:47 Andrii Pasichnyk [this message]
2026-11-26 9:47 ` [PATCH net v2 1/2] wireguard: peer: free packets left on the per-peer queues on removal Andrii Pasichnyk
2026-11-27 9:48 ` netdev-bot+sashiko
2026-11-27 9:59 ` Andrii Pasichnyk
2026-11-26 9:47 ` [PATCH net v2 2/2] wireguard: selftests: remove a peer under load Andrii Pasichnyk
2026-11-27 9:48 ` netdev-bot+sashiko
2026-11-27 9:59 ` Andrii Pasichnyk
2026-11-26 9:52 ` [PATCH net v2 0/2] wireguard: free queued packets on peer removal, and test it netdev-bot+sinfo
2026-11-27 10:22 ` Andrii Pasichnyk
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=20261126094722.73025-1-apasichnik9@gmail.com \
--to=apasichnik9@gmail.com \
--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=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--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.