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=1796407889; b=g8uqhaMxYEI+eoQPquelKWpDLe8HXidptK0tfQ9D8YGczs98MeCCComz6rvi/bU5zxDj cCenVltAQ9CsCpQZBhdwZGLzVZhKQpo/BlAmN7ANTa2T7/FeOcj+G1BPfkA6KMpXKn4TX ikdSTzYd1AiZEH47QpZLqibqkWsVjH3BI+kzCOf3nsbEwE15sBrdzydDSE/4ssoBrCzFf VcK1mjZLr61+K4Tj/ZhtxlXPD5vtNv8Hw4tRWrbSZH4Q/643PDbscOiHonm0/NE1GaEWc 5Pe1WR4NlAdG0adKb+QmT2+jpkKCcrQfw3w0R1wFe577gxi0RU4DNUZEg4vMgDT5DcA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796407889; 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=KGulyHxoGGJDCDtfvobtYVUtyC+5DmaRRvBFSAcpbqs=; b=H5TmQFUoiapcTZEJeWJm8sI/S+7JAYgMGk90LT0Cj7cyhAoIwGPlvCk819JssR/ZDfM5 vgAP84hmOlI/pxO1ojEQKLSSYobHoesMxtKGBpEvT0Acmtlh4figMuBg0dMrdXr/l0pSj nS96hp4A01V2MZoF20fjA2n9Fauu36Kww3g64p9N+VD/2GNMcbsnKFxO6n+uqWA4T7iTO Yupl/Bp0CxKV7kJ26kIBhjMEUgNFC6Cqlh3CD/faPnAYoMNqNhlfT4SooudItB7tNKEAj N+6gxSm4OFDv6xtlulkBNaWi6VwA1fXY7jbGqhXwnMIqkpuLd/rdYG0zqOy9dYdvT8A== 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=UVZAVUVR; 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 B5CBD606A322; Fri, 4 Dec 2026 18:11:29 +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=UVZAVUVR Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6D0A1F00A13; Fri, 4 Dec 2026 18:11:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796407889; bh=KGulyHxoGGJDCDtfvobtYVUtyC+5DmaRRvBFSAcpbqs=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=UVZAVUVRndo7fOmhpEkTnfn7wBzgwddnDER1yFKRBIVEM7349Ymdhueb7KuG+si9M H69v2BKqDwfcq+wjy0z45b5EYow/ZnBsmUkxh3Fb0mk1oFscJaUeEsYwZpNxuFk/6l lDB/26Er9L/fPQI5wV1jBnFCwHvLJ0AiD6EYtCnFjArO+TH41YZzkAuSkSc9XvTicb UuGpcu01XVOdJEhUPm4JdF/rNUI1GaqZZaDkoRL2OwhL43F/g1PCYqyQQOKtckM+uD ZAfI99d7wT0nnbByL9FoNHELns8OI7UlapJyBNUnsfsCcMlTjIvSLYYkL+KfED16hJ Kpu9wWjyZxW9Q== Subject: Re: [PATCH net-next v2] eth: fbnic: Support XDP redirect From: netdev-bot+sashiko@kernel.org To: bjorn@kernel.org Cc: alexanderduyck@fb.com, kuba@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, willemb@google.com, netdev@vger.kernel.org, bpf@vger.kernel.org, kernel-team@meta.com, sdf@fomichev.me, horms@kernel.org, dimitri.daskalakis1@gmail.com, bobbyeshleman@meta.com, daniel.zahka@gmail.com, mike.marciniszyn@gmail.com, hmohsin@meta.com, leitao@debian.org Date: Fri, 04 Dec 2026 18:11:27 +0000 Message-ID: <179640788740.3146.6062961675841789495@kernel.org> In-Reply-To: <20261203180924.3862144-1-bjorn@kernel.org> References: <20261203180924.3862144-1-bjorn@kernel.org> X-sashiko-severity: High 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: 1 · Medium: 0 · 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). - [High] This patch lets fbnic hand multi-buffer XDP frames to redirect targets. -- eth: fbnic: Support XDP redirect This commit adds the XDP_REDIRECT verdict to fbnic_run_xdp() and advertises NETDEV_XDP_ACT_REDIRECT. Each RX queue flushes its pending redirects once per poll, and a flag in the NAPI vector records when a flush is needed. > diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c > index 381831b7e1080..9525ad2f7e14d 100644 > --- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c > +++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c [ ... ] > @@ -1211,10 +1212,15 @@ static struct sk_buff *fbnic_run_xdp(struct fbnic_napi_vector *nv, > return fbnic_build_skb(nv, pkt); > case XDP_TX: > return ERR_PTR(fbnic_pkt_tx(nv, pkt)); > + case XDP_REDIRECT: > + if (xdp_do_redirect(nv->napi.dev, &pkt->buff, xdp_prog)) > + goto xdp_exception; > + return ERR_PTR(-FBNIC_XDP_REDIRECT); [Severity: High] Can multi-buffer frames redirected from fbnic end up as skbs whose truesize is much smaller than the memory they hold? REDIRECT is now advertised together with NETDEV_XDP_ACT_RX_SG. That means a header-split frame with payload frags can reach a cpumap (or veth). There, cpu_map_kthread_run() builds the skb with __xdp_build_skb_from_frame(), which ignores sinfo->xdp_frags_truesize: net/core/xdp.c:__xdp_build_skb_from_frame() { ... if (unlikely(xdp_frame_has_frags(xdpf))) xdp_update_skb_frags_info(skb, nr_frags, sinfo->xdp_frags_size, nr_frags * xdpf->frame_sz, xdp_frame_get_skb_flags(xdpf)); ... } In fbnic, frame_sz only covers the header chunk: drivers/net/ethernet/meta/fbnic/fbnic_txrx.c:fbnic_pkt_prepare() { ... frame_sz = hdr_pg_end - hdr_pg_start; xdp_init_buff(&pkt->buff, frame_sz, &qt->xdp_rxq); ... } With FBNIC_RX_HROOM and FBNIC_RX_TROOM, that comes to roughly 704 bytes for a split TCP header. The payload frags are added in fbnic_add_rx_frag() with their real truesize, which can be up to FBNIC_BD_PAGE_SIZE - pg_off: added = xdp_buff_add_frag(&pkt->buff, netmem, pg_off, len, truesize); xdp_buff_add_frag() can also coalesce adjacent device pages into one frag. So a 9000-byte jumbo payload could end up as nr_frags == 1 with about 9 KiB of real truesize, yet it would be charged only frame_sz. The XDP_PASS path avoids this, because xdp_build_skb_from_buff() prefers sinfo->xdp_frags_truesize. The redirect-to-cpumap path does not. If skb->truesize ends up below skb->len, socket rcvbuf and tcp_mem accounting would be under-charged by a large factor. A remote sender could exploit that to pin far more memory than the limits allow. It would also trigger this warning when TCP coalesces into the receive-queue tail via tcp_queue_rcv()->tcp_try_coalesce()-> skb_try_coalesce(): if (WARN_ON_ONCE(delta < 0 || delta < len)) return false; Would it make sense to have __xdp_build_skb_from_frame() use sinfo->xdp_frags_truesize? That field should still be valid, since xdp_convert_buff_to_frame() does not touch it. Alternatively, could frames with frags be kept off the redirect path until the core accounts for them correctly? > default: > bpf_warn_invalid_xdp_action(nv->napi.dev, xdp_prog, act); > fallthrough; > case XDP_ABORTED: > +xdp_exception: > trace_xdp_exception(nv->napi.dev, xdp_prog, act); > fallthrough; > case XDP_DROP: [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203180924.3862144-1-bjorn%40kernel.org