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/2026…%40kernel.org