From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795940877; b=QT0NhZahx6CnT/Z6FgdEaxQdd5RWRKnKEV8WbPlZr4ncnvwQPfuzb1LPRNTYzETVrYdl selyfCLPEE0Qvmmp9O3kBXGtH7+ouaYRzSHA+atBoXKAIqhRwLHc4shoc+QAF9HRDYiAE l+9nMofNTy40tTTL6LnbsQPnSzhp35fk1bjElzDkE0jaftkGv2W6Yvf6vo4dCblXwrJzI O8/WJNTLjDG882gh7wlgn0zw2LNjy8a3Lm7RNog6rneFRqk7So1JRc27DpjMksdutrUt9 q/zuscJBtbCjpU0xMgXfcm8j2hFUJxdIvhZrty2mjaI4hSplAeeA6PHrVj9TGvj1SIA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795940877; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=LzMRAHUometdg54yhhZDhAm3bbj/wdX2smHuy6837qw=; b=OdzmsBwgYq27hrPtgPb4TlsHNIN6GNeY3cxA+FdSJf//iKUCMytQwz6Wb3Y9VmIhdtAQ zFMfN3hZSQne9q7f1V8zjhjpwY8bO6TdJvZNwf4LPj7m09Lr4QbKJjxgTOKvlnalO0fEl jG23yXqPXNKPusJYUunRFDIpBg7UV9bL2VjyVDxqZm478BaM0gE9h5XJfv4bCZDPhA6Qa x9Dx/CbsPqpJNksT+cNBkNBpeYP7Qixxut/cJ7yExc5GRVY8SIYx1pd7H4or454UZbk+B F/10MyTjJvo0Wic1OHUlv5158aff725KT4wV/mJVvk6WS/dq3iIoERvLiSR7/GZCBkg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NDWKSQha; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22384606A32D; Sun, 29 Nov 2026 08:27:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NDWKSQha Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04C9A1F000C1; Sun, 29 Nov 2026 08:27:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795940876; bh=LzMRAHUometdg54yhhZDhAm3bbj/wdX2smHuy6837qw=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=NDWKSQhalWsUdyUpaUQgTE/4bhqBK+4nLEEoQFt/1paNg76c1paSWGPSeitGeVu5D 97O8rcndtz45n7r51hST5DK0onGEBaSwbW74VXazoSo6w32uDq5PkdvMSfbgmQJGDG njIGQwu1zASeXzEOxa4cFmYMv9oRRzxjhOcuOdLSyCeQ6JZ3gWPUxLrXPN58ja9Jep d88D4tK+vFn5eQnAa3IzuKA0HPvZBctL7xbIsqmZHd8st48KtyMJ9ZTGnAUuifzDLH nROQNAp9DCppT5K11RYe/K+o7CpEs0nDCfEU5GFpoZJc6SnVEZUIxQMjwdWmsJR6Im 9xI3edMG/NAiQ== Subject: Re: [PATCH net v3 4/5] vmxnet3: drop XDP frames that do not fit in one rx buffer From: netdev-bot+sashiko@kernel.org To: filzador@gmail.com Cc: ronak.doshi@broadcom.com, bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org, bpf@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, u9012063@gmail.com Date: Sun, 29 Nov 2026 08:27:55 +0000 Message-ID: <179594087560.3146.8294301865977150437@kernel.org> In-Reply-To: <20261125075255.1517-5-filzador@gmail.com> References: <20261125075255.1517-5-filzador@gmail.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 (1) · Medium: 1 · Low: 0 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] Besides the XDP crash, this patch fixes a second, older crash in the non-XDP rx path, but its only Fixes: tag points at the XDP… Pre-existing issues: - [High] This problem wasn't introduced by this patch, but it is a serious one in the same XDP rx path. -- vmxnet3: drop XDP frames that do not fit in one rx buffer With XDP enabled, a frame that spans a head and a body descriptor used to fall through to the skb path in vmxnet3_rq_rx_complete(). That path treated the page_pool page in rbi->skb as an skb and crashed. This patch drops such frames, starts each poll with skip_page_frags set when no frame is in progress, and adds drop_total accounting to the body buffer allocation failure paths. > diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c > index e8be95c1d9f8e..234897abfe0ad 100644 > --- a/drivers/net/vmxnet3/vmxnet3_drv.c > +++ b/drivers/net/vmxnet3/vmxnet3_drv.c > @@ -1614,7 +1614,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, > adapter->rx_prod_offset, adapter->rx_prod2_offset > }; > u32 num_pkts = 0; > - bool skip_page_frags = false; > + /* A frame dropped at its head may continue in the next poll. */ > + bool skip_page_frags = !rq->rx_ctx.skb; [Severity: Medium] This initialization also fixes an older crash in the non-XDP rx path. The commit message says so: This also changes the non-XDP rx path, whose head buffer drops (skb allocation or DMA mapping failure) had the same problem before XDP support was added Here is the sequence in vmxnet3_rq_rx_complete(). If netdev_alloc_skb_ip_align() or dma_map_single() fails on a head buffer, ctx->skb is set to NULL and skip_page_frags to true. The loop then exits because rcd->gen does not yet match rq->comp_ring.gen for the body completion. The next poll used to start with skip_page_frags == false, so the orphan body hit: BUG_ON(ctx->skb == NULL && !skip_page_frags); That BUG_ON and the skip_page_frags handling appear to come from commit 5318d809d7b4 ("vmxnet3: fix starving rx ring whenoc_skb kb fails") from 2011. The only tag here is: Fixes: 54f00cce1178 ("vmxnet3: Add XDP support.") which landed in v6.6. Will stable trees that have the non-XDP code but not vmxnet3 XDP miss this crash fix? The fix is mixed in with XDP-only code (VMXNET3_RX_BUF_XDP, vmxnet3_xdp_enabled()), so it also looks hard to cherry-pick into those trees. Could the non-XDP part go into a separate patch with its own Fixes: 5318d809d7b4 tag? That part is the poll-start skip_page_frags initialization, the eop/err skip for an already dropped frame, and the extra drop_total accounting. Failing that, could this patch at least carry the additional tag? > bool encap_lro = false; > struct Vmxnet3_RxCompDesc *rcd; > struct vmxnet3_rx_ctx *ctx = &rq->rx_ctx; [ ... ] > + if (rcd->sop && !rcd->eop && > + rbi->buf_type == VMXNET3_RX_BUF_XDP && > + !VMXNET3_RX_DATA_RING(adapter, rcd->rqID)) { > + /* The frame did not fit one XDP buffer. XDP here is > + * single-buffer and the head holds a page, not an > + * skb: drop the frame, reuse the head buffer and > + * skip the body buffers. > + */ > + rq->stats.drop_total++; > + ctx->skb = NULL; > + skip_page_frags = true; > + goto rcd_done; > + } > + > if (rcd->sop && rcd->eop && vmxnet3_xdp_enabled(adapter)) { > struct sk_buff *skb_xdp_pass; > int act; [Severity: High] This is a pre-existing issue, not one introduced by this patch, but it sits in the same XDP rx path. Can vmxnet3_process_xdp() in vmxnet3_xdp.c leave the rx descriptor pointing at a page it has already given away? On XDP_PASS the head page goes into an skb, and on a successful XDP_TX or XDP_REDIRECT it goes to the TX ring or the redirect target. Only then is a replacement allocated: drivers/net/vmxnet3/vmxnet3_xdp.c:vmxnet3_process_xdp() { ... if (act == XDP_PASS) { out_skb: *skb_xdp_pass = vmxnet3_build_skb(rq, page, &xdp); ... } new_data = vmxnet3_pp_get_buff(rq->page_pool, &new_dma_addr, GFP_ATOMIC); if (!new_data) { rq->stats.rx_buf_alloc_failure++; return XDP_DROP; } rbi->page = virt_to_page(new_data); rbi->dma_addr = new_dma_addr; rxd->addr = cpu_to_le64(rbi->dma_addr); ... } When that GFP_ATOMIC allocation fails, rbi->page, rbi->dma_addr and rxd->addr are left unchanged. The caller in vmxnet3_rq_rx_complete() then sees XDP_DROP. It sets ctx->skb = NULL, which leaks the skb just built in the PASS case. It does not set need_flush for a redirect that already succeeded. Then it jumps to rcd_done. The refill at rcd_done sets rxd->gen = ring->gen and gives the descriptor back to the device with the old DMA address. The device can then DMA new rx data into a page that is being transmitted or is owned by a redirect target. After TX completion that page can go back into the page pool and be handed to another rx descriptor. If the pool is full, it can be released and unmapped while this ring still points at it. The XDP_DROP and XDP_ABORTED verdicts, and failed TX or redirect, look safe because page_pool_recycle_direct() refills the alloc cache just before the allocation. Should the replacement buffer be allocated before the page is handed off, or should a failed refill keep the descriptor out of the ring? > > if (VMXNET3_RX_DATA_RING(adapter, rcd->rqID)) { > ctx->skb = NULL; [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125075255.1517-1-filzador%40gmail.com