* [PATCH net v2 0/2] wireguard: free queued packets on peer removal, and test it
@ 2026-11-26 9:47 Andrii Pasichnyk
2026-11-26 9:47 ` [PATCH net v2 1/2] wireguard: peer: free packets left on the per-peer queues on removal Andrii Pasichnyk
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Andrii Pasichnyk @ 2026-11-26 9:47 UTC (permalink / raw)
To: Jason A . Donenfeld
Cc: wireguard, netdev, Andrew Lunn, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Shuah Khan, linux-kselftest,
linux-kernel
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
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH net v2 1/2] wireguard: peer: free packets left on the per-peer queues on removal 2026-11-26 9:47 [PATCH net v2 0/2] wireguard: free queued packets on peer removal, and test it Andrii Pasichnyk @ 2026-11-26 9:47 ` Andrii Pasichnyk 2026-11-27 9:48 ` netdev-bot+sashiko 2026-11-26 9:47 ` [PATCH net v2 2/2] wireguard: selftests: remove a peer under load 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 2 siblings, 1 reply; 9+ messages in thread From: Andrii Pasichnyk @ 2026-11-26 9:47 UTC (permalink / raw) To: Jason A . Donenfeld Cc: wireguard, netdev, Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Shuah Khan, linux-kselftest, linux-kernel peer_remove_after_dead() flushes the crypt workqueue and then disables the peer's NAPI. Once a disable is pending, __napi_poll() completes the instance after the poll returns even if it used its whole budget, so a peer removed while more than one budget of decrypted packets waits on rx_queue keeps the rest there. Each entry holds a keypair and a peer reference, so the peer is never released; the WARN_ON in rcu_release() that checks for leftovers is never reached either. Free whatever is left on both per-peer queues once nothing can feed them any more: receive entries are single packets, transmit entries lists. Reproduced with the WireGuard selftest VM (x86 KVM): remove a peer while a UDP flood keeps its receive queue busy, re-add it, bring the session back up, repeat, then run the selftest's created/destroyed object check. With 1 vCPU the unpatched kernel leaks a peer and its keypair in 25-40% of such removals ("wg0: Peer 11: merely created"); with this patch, 0 in 212 removals. The next patch adds the loop to netns.sh. Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") Signed-off-by: Andrii Pasichnyk <apasichnik9@gmail.com> --- drivers/net/wireguard/peer.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/net/wireguard/peer.c b/drivers/net/wireguard/peer.c index 1cb502a93..3e08898ce 100644 --- a/drivers/net/wireguard/peer.c +++ b/drivers/net/wireguard/peer.c @@ -91,6 +91,25 @@ static void peer_make_dead(struct wg_peer *peer) /* The caller must now synchronize_net() for this to take effect. */ } +/* Each queue entry holds a keypair and a peer reference. Transmit entries + * are lists of packets, receive entries single packets. + */ +static void peer_purge_queue(struct wg_peer *peer, struct prev_queue *queue, + bool lists) +{ + struct sk_buff *first; + + while ((first = wg_prev_queue_peek(queue)) != NULL) { + wg_prev_queue_drop_peeked(queue); + wg_noise_keypair_put(PACKET_CB(first)->keypair, false); + wg_peer_put(peer); + if (lists) + kfree_skb_list(first); + else + dev_kfree_skb(first); + } +} + static void peer_remove_after_dead(struct wg_peer *peer) { WARN_ON(!peer->is_dead); @@ -122,6 +141,11 @@ static void peer_remove_after_dead(struct wg_peer *peer) * here from process context. */ netif_napi_del(&peer->napi); + /* A NAPI being disabled completes after at most one more poll, which + * may leave packets on rx_queue that still hold references. + */ + peer_purge_queue(peer, &peer->rx_queue, false); + peer_purge_queue(peer, &peer->tx_queue, true); /* Ensure any workstructs we own (like transmit_handshake_work or * clear_peer_work) no longer are in use. base-commit: e509726660dd06ce107437aecf7c106c9d3fc1e7 -- 2.43.0 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net v2 1/2] wireguard: peer: free packets left on the per-peer queues on removal 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 0 siblings, 1 reply; 9+ messages in thread From: netdev-bot+sashiko @ 2026-11-27 9:48 UTC (permalink / raw) To: apasichnik9 Cc: Jason, wireguard, netdev, andrew+netdev, davem, edumazet, kuba, pabeni, shuah, linux-kselftest, linux-kernel Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 0 · Low: 1 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [High] The new tx_queue purge in peer_remove_after_dead() (drivers/net/wireguard/peer.c:148) can run while… - [Low] In peer_remove_after_dead() (drivers/net/wireguard/peer.c), the patch adds a purge of the per-peer queues and a comment saying entries… -- wireguard: peer: free packets left on the per-peer queues on removal This patch adds peer_purge_queue(). peer_remove_after_dead() calls it after netif_napi_del() to free anything still left on peer->rx_queue and peer->tx_queue. The aim is to fix a peer/keypair leak: once a disable is pending, NAPI completes even when more than one budget of decrypted packets is still sitting on rx_queue. > diff --git a/drivers/net/wireguard/peer.c b/drivers/net/wireguard/peer.c > index 1cb502a932e07..3e08898cec5ec 100644 > --- a/drivers/net/wireguard/peer.c > +++ b/drivers/net/wireguard/peer.c > @@ -91,6 +91,25 @@ static void peer_make_dead(struct wg_peer *peer) > /* The caller must now synchronize_net() for this to take effect. */ > } > > +/* Each queue entry holds a keypair and a peer reference. Transmit entries > + * are lists of packets, receive entries single packets. > + */ > +static void peer_purge_queue(struct wg_peer *peer, struct prev_queue *queue, > + bool lists) > +{ > + struct sk_buff *first; > + > + while ((first = wg_prev_queue_peek(queue)) != NULL) { > + wg_prev_queue_drop_peeked(queue); > + wg_noise_keypair_put(PACKET_CB(first)->keypair, false); > + wg_peer_put(peer); > + if (lists) > + kfree_skb_list(first); > + else > + dev_kfree_skb(first); > + } > +} > + [ ... ] > @@ -122,6 +141,11 @@ static void peer_remove_after_dead(struct wg_peer *peer) > * here from process context. > */ > netif_napi_del(&peer->napi); > + /* A NAPI being disabled completes after at most one more poll, which > + * may leave packets on rx_queue that still hold references. > + */ > + peer_purge_queue(peer, &peer->rx_queue, false); > + peer_purge_queue(peer, &peer->tx_queue, true); [Severity: High] Can this purge of peer->tx_queue run while peer->transmit_packet_work is still pending or running on packet_crypt_wq? All peers on a device share wg->encrypt_queue, and the per-CPU wg_packet_encrypt_worker() drains it. Each flush_workqueue() call only waits for work that was queued before that flush started. Here is one possible interleaving: flush_workqueue() #1 (step a) is running another peer's xmit queues encrypt worker W on packet_crypt_wq (flush #1 does not wait for W) W pops one of this peer's entries from the shared ring flush #1 returns flush_workqueue() #2 (step b.1) waits for W W: wg_packet_encrypt_worker()->wg_queue_enqueue_per_peer_tx() queue_work_on(..., peer->device->packet_crypt_wq, &peer->transmit_packet_work); (queued after flush #2 started, so nothing waits for it) flush #2 returns napi_disable(); netif_napi_del(); /* only a synchronize_net() */ peer_purge_queue(peer, &peer->tx_queue, true); If wg_packet_tx_worker() runs at the same time, it and peer_purge_queue() both consume tx_queue. prev_queue is single-consumer, so wg_prev_queue_peek() and wg_prev_queue_dequeue() update queue->peeked and queue->tail without a lock. Could both sides get the same skb list? That would mean a double kfree_skb_list() plus a double wg_noise_keypair_put() and wg_peer_put(). If transmit_packet_work is still pending instead, the purge drops the peer references held by the tx_queue entries. The final wg_peer_put() in peer_remove_after_dead() can then go through kref_release()->call_rcu(rcu_release) and free the peer while transmit_packet_work is still linked on the workqueue. Would wg_packet_tx_worker() then run container_of() on freed memory? Before this patch, a late tx worker was the only consumer, and the queued entries kept the peer alive. This also seems to contradict the commit message: Free whatever is left on both per-peer queues once nothing can feed them any more The follow-up patch in the series only touches the selftests and does not change this code. Would a flush_work() or cancel_work_sync() on &peer->transmit_packet_work before purging tx_queue close this window? [Severity: Low] This isn't a bug, but the earlier comment in peer_remove_after_dead() is left as it was, and it now contradicts the new one: /* The transition between packet encryption/decryption queues isn't * guarded by is_dead, but each reference's life is strictly bounded by * two generations: once for parallel crypto and once for serial * ingestion, so we can simply flush twice, and be sure that we no * longer have references inside these queues. */ The a), b.1) and b.2.1) step comments also still describe the two flushes plus napi_disable() as a complete drain. __napi_poll() in net/core/dev.c does this: if (unlikely(napi_disable_pending(n))) { napi_complete(n); return work; } That makes the new comment the accurate one. Should the old comment be updated to match? Also, the new comment only covers rx_queue, but the next line purges tx_queue too. Could the comment say why the tx_queue purge is needed, or that it is only defensive? The follow-up selftest patch in the series doesn't update this comment either. > > /* Ensure any workstructs we own (like transmit_handshake_work or > * clear_peer_work) no longer are in use. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126094722.73025-1-apasichnik9%40gmail.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net v2 1/2] wireguard: peer: free packets left on the per-peer queues on removal 2026-11-27 9:48 ` netdev-bot+sashiko @ 2026-11-27 9:59 ` Andrii Pasichnyk 0 siblings, 0 replies; 9+ messages in thread From: Andrii Pasichnyk @ 2026-11-27 9:59 UTC (permalink / raw) To: Jason A . Donenfeld Cc: wireguard, netdev, Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Shuah Khan, linux-kselftest, linux-kernel Sashiko AI review wrote: > [Severity: High] > Can this purge of peer->tx_queue run while peer->transmit_packet_work is > still pending or running on packet_crypt_wq? Yes, it can. An encrypt worker that the second flush waits for can queue transmit_packet_work after that flush has started, and then nothing waits for it. Before this patch that was harmless, because the entries on tx_queue keep the peer alive until the worker has consumed them. The purge breaks that. > Would a flush_work() or cancel_work_sync() on &peer->transmit_packet_work > before purging tx_queue close this window? It would, but the tx_queue purge is not needed at all. The leak I reproduced is on rx_queue only: the transmit worker has no budget and drains everything that is ready. So v3 will drop the tx_queue purge and free only what the disabled NAPI left on rx_queue. As far as I can see rx_queue does not have the same window: a decrypt worker queues no further work when it is done, it only schedules the NAPI, and napi_disable() waits for the poll. > [Severity: Low] > That makes the new comment the accurate one. Should the old comment be > updated to match? Yes. v3 updates it and says why tx_queue is left alone. Thanks, Andrii pw-bot: cr ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net v2 2/2] wireguard: selftests: remove a peer under load 2026-11-26 9:47 [PATCH net v2 0/2] wireguard: free queued packets on peer removal, and test it Andrii Pasichnyk 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-26 9:47 ` Andrii Pasichnyk 2026-11-27 9:48 ` netdev-bot+sashiko 2026-11-26 9:52 ` [PATCH net v2 0/2] wireguard: free queued packets on peer removal, and test it netdev-bot+sinfo 2 siblings, 1 reply; 9+ messages in thread From: Andrii Pasichnyk @ 2026-11-26 9:47 UTC (permalink / raw) To: Jason A . Donenfeld Cc: wireguard, netdev, Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Shuah Khan, linux-kselftest, linux-kernel Remove a peer while a UDP flood keeps its receive queue busy, re-add it, and repeat ten times. Packets left on the per-peer queues keep the peer and its keypair alive, which the created/destroyed object check at the end of netns.sh reports as "merely created". The ping after the re-add makes the new peer handshake at once. Without it the other side keeps using the old keypair until its own timers start a handshake, nothing flows in the meantime, and only the first removal happens under load. netns.sh sets message_cost to 0, so every removal under load logs up to about 1000 "Packet has unallowed src IP" lines. Ten of them overflow the 256 KB kernel log buffer; the object check then reads an incomplete log, reports peers as "merely destroyed" and can miss real leaks. Raise CONFIG_LOG_BUF_SHIFT to 20. The loop adds about 13 seconds to a run. Without the previous patch it fails in every run with 1 vCPU. Signed-off-by: Andrii Pasichnyk <apasichnik9@gmail.com> --- tools/testing/selftests/wireguard/netns.sh | 14 ++++++++++++++ .../testing/selftests/wireguard/qemu/kernel.config | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh index a8f550aec..8303802c0 100755 --- a/tools/testing/selftests/wireguard/netns.sh +++ b/tools/testing/selftests/wireguard/netns.sh @@ -207,6 +207,20 @@ n0 iptables -F INPUT ip1 link set wg0 mtu $orig_mtu ip2 link set wg0 mtu $orig_mtu +# Remove a peer while a UDP flood keeps its receive queue busy, then re-add it; +# packets left on the per-peer queues would keep it from being destroyed, +# which the created/destroyed check at the end catches. +for ((i = 0; i < 10; ++i)); do + n1 iperf3 -s -1 -B 192.168.241.1 & + pids=( $! ); waitiperf $netns1 $! + n2 iperf3 -Z -t 2 -b 0 -u -l 64 -P 4 -c 192.168.241.1 >/dev/null 2>&1 & + pids+=( $! ); sleep 1 + n1 wg set wg0 peer "$pub2" remove + kill "${pids[@]}" 2>/dev/null || true; wait "${pids[@]}" || true + n1 wg set wg0 peer "$pub2" preshared-key <(echo "$psk") allowed-ips 192.168.241.2/32,fd00::2/128 endpoint 127.0.0.1:2 + n1 ping -c 1 -W 1 192.168.241.2 +done + # Test using IPv4 that roaming works ip0 -4 addr del 127.0.0.1/8 dev lo ip0 -4 addr add 127.212.121.99/8 dev lo diff --git a/tools/testing/selftests/wireguard/qemu/kernel.config b/tools/testing/selftests/wireguard/qemu/kernel.config index 368fd9d60..c69a408a5 100644 --- a/tools/testing/selftests/wireguard/qemu/kernel.config +++ b/tools/testing/selftests/wireguard/qemu/kernel.config @@ -67,7 +67,7 @@ CONFIG_SYSCTL=y CONFIG_SYSFS=y CONFIG_TMPFS=y CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15 -CONFIG_LOG_BUF_SHIFT=18 +CONFIG_LOG_BUF_SHIFT=20 CONFIG_PRINTK_TIME=y CONFIG_BLK_DEV_INITRD=y CONFIG_LEGACY_VSYSCALL_NONE=y -- 2.43.0 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net v2 2/2] wireguard: selftests: remove a peer under load 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 0 siblings, 1 reply; 9+ messages in thread From: netdev-bot+sashiko @ 2026-11-27 9:48 UTC (permalink / raw) To: apasichnik9 Cc: Jason, wireguard, netdev, andrew+netdev, davem, edumazet, kuba, pabeni, shuah, linux-kselftest, linux-kernel Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 2 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] Raising CONFIG_LOG_BUF_SHIFT from 18 to 20 leaves almost no headroom for the log volume the new loop in… - [Low] The commit message gives the test's ability to detect the regression only for 1 vCPU ('Without the previous patch it fails in… - [Low] The new loop in netns.sh (lines 213-222) relies on fixed waits at two points and checks neither result. -- wireguard: selftests: remove a peer under load This adds a loop to netns.sh that removes and re-adds a peer ten times while a UDP iperf3 flood keeps its receive queue busy. The final created/destroyed object check should then catch peers or keypairs that queued packets keep alive. It also raises CONFIG_LOG_BUF_SHIFT from 18 to 20 in the qemu kernel.config so the log can hold the extra output. > The loop adds about 13 seconds to a run. Without the previous patch it > fails in every run with 1 vCPU. [Severity: Low] The detection rate is given only for 1 vCPU, but the qemu harness uses 4 vCPUs by default: tools/testing/selftests/wireguard/qemu/Makefile: NR_CPUS ?= 4 ... -smp $(NR_CPUS) \ With 4 vCPUs, NAPI and the decrypt workers get more CPU time to drain rx_queue before napi_disable(). The loop may therefore catch the regression less often in a default run. Could the commit message give the detection rate with the default NR_CPUS? Or it could say that NR_CPUS=1 is needed to reproduce the regression reliably. > diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh > index a8f550aecb35d..8303802c02f27 100755 > --- a/tools/testing/selftests/wireguard/netns.sh > +++ b/tools/testing/selftests/wireguard/netns.sh > @@ -207,6 +207,20 @@ n0 iptables -F INPUT [ ... ] > +for ((i = 0; i < 10; ++i)); do > + n1 iperf3 -s -1 -B 192.168.241.1 & > + pids=( $! ); waitiperf $netns1 $! > + n2 iperf3 -Z -t 2 -b 0 -u -l 64 -P 4 -c 192.168.241.1 >/dev/null 2>&1 & > + pids+=( $! ); sleep 1 > + n1 wg set wg0 peer "$pub2" remove > + kill "${pids[@]}" 2>/dev/null || true; wait "${pids[@]}" || true > + n1 wg set wg0 peer "$pub2" preshared-key <(echo "$psk") allowed-ips 192.168.241.2/32,fd00::2/128 endpoint 127.0.0.1:2 > + n1 ping -c 1 -W 1 192.168.241.2 > +done [Severity: Low] Does anything confirm that the peer is actually under load when it is removed? The fixed sleep 1 is the only ordering between starting the flood and the removal. The client's output goes to /dev/null, and wait ... || true throws away its exit status. The iperf3 UDP streams might not start within that second, which is possible on slow TCG targets. The iteration would then remove an idle peer and the final object check would still pass. The leak this loop targets would go unnoticed. Checking wg show wg0 transfer, or rx_bytes on n1, before the removal would catch that. Separately, can the single ping abort the whole run? It needs a full new handshake plus a round trip within 1 second. It also runs under set -e with no retry. If a handshake packet is lost or late, the next attempt only comes after REKEY_TIMEOUT (5 seconds). The ping then fails and netns.sh exits. Right after the removal, up to 1024 queued packets may still be draining. About 1000 KERN_DEBUG lines are also going to the console, because init.c writes 9 to /proc/sys/kernel/printk. Other places in netns.sh already use a single 1-second ping after a handshake without trouble. This is a timing concern rather than an observed failure. > diff --git a/tools/testing/selftests/wireguard/qemu/kernel.config b/tools/testing/selftests/wireguard/qemu/kernel.config > index 368fd9d600c83..c69a408a5a94c 100644 > --- a/tools/testing/selftests/wireguard/qemu/kernel.config > +++ b/tools/testing/selftests/wireguard/qemu/kernel.config > @@ -67,7 +67,7 @@ CONFIG_SYSCTL=y [ ... ] > -CONFIG_LOG_BUF_SHIFT=18 > +CONFIG_LOG_BUF_SHIFT=20 [Severity: Medium] Does 1 MiB leave enough headroom for what the new loop can log? netns.sh sets message_cost to 0, and WIREGUARD_DEBUG=y defines DEBUG. In wg_peer_remove(), peer_make_dead() takes the peer out of allowedips first. NAPI then keeps draining peer->rx_queue until napi_disable(). Each packet handled in that window fails the source check and logs a line: drivers/net/wireguard/receive.c:wg_packet_consume_data_done() { ... net_dbg_skb_ratelimited("%s: Packet has unallowed src IP (%pISc) from peer %llu (%pISpfsc)\n", ... } The only limit on the per-peer queue is in wg_prev_queue_enqueue(): if (!atomic_add_unless(&queue->count, 1, MAX_QUEUED_PACKETS)) MAX_QUEUED_PACKETS is 1024, so one removal can log about 1024 of these lines. Each record takes about 96 bytes in the printk data ring: about 86 bytes of text plus the 8-byte block id, rounded up. Ten removals can then use 10 * 1024 * 96 = 983,040 bytes. That is about 94% of the 1,048,576-byte ring. Even with the commit message's estimate of about 1000 lines per removal, it is still about 91%. That leaves roughly 65-88 KiB for everything else netns.sh logs, from the run's start to its end. This covers the "created" lines from configure_peers at the start, the handshake and keepalive debug lines, and about 80 netlink-test peers. n2's original "Peer N created" record has to survive the whole run. If the ring wraps, the object check at the end of netns.sh would see a "destroyed" record without its "created" record. It would then report "merely destroyed", which is the failure this change is meant to prevent. The rest of the log has not been measured, so this rests on the arithmetic above. Would setting a non-zero message_cost while the loop runs avoid relying on such a thin margin? A larger shift such as 21 would also work. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126094722.73025-1-apasichnik9%40gmail.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net v2 2/2] wireguard: selftests: remove a peer under load 2026-11-27 9:48 ` netdev-bot+sashiko @ 2026-11-27 9:59 ` Andrii Pasichnyk 0 siblings, 0 replies; 9+ messages in thread From: Andrii Pasichnyk @ 2026-11-27 9:59 UTC (permalink / raw) To: Jason A . Donenfeld Cc: wireguard, netdev, Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Shuah Khan, linux-kselftest, linux-kernel Sashiko AI review wrote: > [Severity: Medium] > Does 1 MiB leave enough headroom for what the new loop can log? In the runs I made it stayed well below that: about 217 lines per removal on average over 200 removals, and 340-400 KB for the busiest ten in a row. But the worst case is what you computed, so v3 raises CONFIG_LOG_BUF_SHIFT to 21. > Would setting a non-zero message_cost while the loop runs avoid relying > on such a thin margin? No: the "Keypair N created/destroyed" lines are rate limited by the same setting, and the object check at the end needs all of them. > [Severity: Low] > Could the commit message give the detection rate with the default > NR_CPUS? Or it could say that NR_CPUS=1 is needed to reproduce the > regression reliably. I only have single unpatched runs there: one with 2 CPUs failed, one with 4 CPUs passed. v3 says that NR_CPUS=1 is the configuration that checks for this. > [Severity: Low] > Does anything confirm that the peer is actually under load when it is > removed? Not in the script. In the runs above every iteration had an accepted iperf3 connection before the removal (10 of 10 and 200 of 200), on KVM; I have not run it under TCG. I kept the loop minimal as Jason asked, and can add a transfer check if that is preferred. Thanks, Andrii ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net v2 0/2] wireguard: free queued packets on peer removal, and test it 2026-11-26 9:47 [PATCH net v2 0/2] wireguard: free queued packets on peer removal, and test it Andrii Pasichnyk 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-26 9:47 ` [PATCH net v2 2/2] wireguard: selftests: remove a peer under load Andrii Pasichnyk @ 2026-11-26 9:52 ` netdev-bot+sinfo 2026-11-27 10:22 ` Andrii Pasichnyk 2 siblings, 1 reply; 9+ messages in thread From: netdev-bot+sinfo @ 2026-11-26 9:52 UTC (permalink / raw) To: Andrii Pasichnyk Cc: Jason A . Donenfeld, wireguard, netdev, Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Shuah Khan, linux-kselftest, linux-kernel Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. *IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages. -- The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net v2 0/2] wireguard: free queued packets on peer removal, and test it 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 0 siblings, 0 replies; 9+ messages in thread From: Andrii Pasichnyk @ 2026-11-27 10:22 UTC (permalink / raw) To: Jason A . Donenfeld Cc: wireguard, netdev, Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Shuah Khan, linux-kselftest, linux-kernel netdev-bot+sinfo@kernel.org wrote: > - How the issue was discovered, e.g. hit in production, hit during > development, syzbot report, manual code inspection, LLM or static > analysis tool scan. The leak was hit on a single-CPU MIPS router (Realtek RTL8196E) in everyday use as a WireGuard gateway, and then reproduced with the WireGuard selftest VM. v3 says so in the commit message of patch 1. Thanks, Andrii ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-11-27 10:22 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-11-26 9:47 [PATCH net v2 0/2] wireguard: free queued packets on peer removal, and test it Andrii Pasichnyk 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®