From: sashiko-bot@kernel.org
To: "Jason Xing" <kerneljasonxing@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net v4 4/5] xsk: drain continuation descs on invalid descriptor in __xsk_generic_xmit()
Date: Sat, 30 May 2026 00:44:17 +0000 [thread overview]
Message-ID: <20260530004417.7D2D61F00899@smtp.kernel.org> (raw)
In-Reply-To: <20260520004244.55663-5-kerneljasonxing@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Failure to update TX ring consumer pointer when processing only invalid or dropped descriptors leads to a deadlocked TX ring.
--
commit 8b2ad485d536e9c6cf90b478357bdf68eb66e24c
Author: Jason Xing <kerneljasonxing@gmail.com>
xsk: drain continuation descs on invalid descriptor in __xsk_generic_xmit()
This commit addresses an issue where an invalid descriptor mid-packet causes
the partial skb to be dropped, but leaves continuation descriptors in the TX
ring. It introduces a drain_cont flag to flush the remaining fragments of
the corrupted multi-buffer packet on subsequent iterations.
> diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
> index f4add7be8c935..de953f38b9e2a 100644
> --- a/net/xdp/xsk.c
> +++ b/net/xdp/xsk.c
> @@ -1122,6 +1122,7 @@ static int __xsk_generic_xmit(struct sock *sk)
> if (xs->skb)
> xsk_drop_skb(xs->skb);
> xskq_cons_release(xs->tx);
> + xs->drain_cont = xp_mb_desc(&desc);
> }
>
> out:
[Severity: High]
This is a pre-existing issue, but does skipping the TX release when there are
no successfully sent frames lead to a deadlocked TX ring?
In __xsk_generic_xmit(), the consumer pointer is updated and the socket is
awoken only if sent_frame is true:
out:
if (sent_frame)
__xsk_tx_release(xs);
The sent_frame flag is set to true only when a packet is successfully
transmitted via __dev_direct_xmit(). If a batch of processing consists
entirely of invalid descriptors, dropped packets, or drained continuations
(including the newly added drain_cont path), sent_frame remains false.
If sent_frame remains false, the function skips calling __xsk_tx_release().
As a result, the advanced cached_cons index is never published to the shared
ring->consumer pointer.
If a workload encounters enough invalid descriptors or drops to fill the
ring, the consumer pointer will never advance. Userspace will see the ring as
completely full and block in poll or sendmsg waiting for EPOLLOUT. Since the
kernel hasn't published the advanced consumer pointer nor called
sk_write_space(), could the socket permanently deadlock?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260520004244.55663-1-kerneljasonxing@gmail.com?part=4
next prev parent reply other threads:[~2026-05-30 0:44 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 0:42 [PATCH net v4 0/5] xsk: fix meta and publish of cq issues Jason Xing
2026-05-20 0:42 ` [PATCH net v4 1/5] xsk: cache csum_start/csum_offset to fix TOCTOU in xsk_skb_metadata() Jason Xing
2026-05-21 12:04 ` Maciej Fijalkowski
2026-05-30 0:44 ` sashiko-bot
2026-05-20 0:42 ` [PATCH net v4 2/5] xsk: fix buffer leak in xsk_drop_skb() for AF_XDP multi-buffer Tx Jason Xing
2026-05-21 12:05 ` Maciej Fijalkowski
2026-05-20 0:42 ` [PATCH net v4 3/5] xsk: drain continuation descs after overflow in xsk_build_skb() Jason Xing
2026-05-20 16:10 ` Maciej Fijalkowski
2026-05-20 23:53 ` Jason Xing
2026-05-21 12:02 ` Maciej Fijalkowski
2026-05-21 13:10 ` Jason Xing
2026-05-22 9:06 ` Magnus Karlsson
2026-05-22 9:22 ` Jason Xing
2026-05-30 0:44 ` sashiko-bot
2026-05-20 0:42 ` [PATCH net v4 4/5] xsk: drain continuation descs on invalid descriptor in __xsk_generic_xmit() Jason Xing
2026-05-30 0:44 ` sashiko-bot [this message]
2026-05-20 0:42 ` [PATCH net v4 5/5] selftests/xsk: drain CQ to wait for TX completion Jason Xing
2026-05-30 0:44 ` sashiko-bot
2026-05-21 12:23 ` [PATCH net v4 0/5] xsk: fix meta and publish of cq issues Maciej Fijalkowski
2026-05-21 12:41 ` Jason Xing
2026-05-21 12:59 ` Maciej Fijalkowski
2026-05-21 13:07 ` Jason Xing
2026-05-21 14:24 ` Maciej Fijalkowski
2026-05-22 8:55 ` Jason Xing
2026-05-22 13:48 ` Jason Xing
2026-05-22 18:33 ` Maciej Fijalkowski
2026-05-22 23:49 ` Jason Xing
2026-05-26 19:43 ` Maciej Fijalkowski
2026-05-26 23:26 ` Jason Xing
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=20260530004417.7D2D61F00899@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=kerneljasonxing@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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