From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Felix Fietkau <nbd@nbd.name>,
netdev@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
Neal Cardwell <ncardwell@google.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
"David S. Miller" <davem@davemloft.net>,
David Ahern <dsahern@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Willem de Bruijn <willemb@google.com>,
Richard Gobert <richardbgobert@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: fix segmentation after TCP/UDP fraglist GRO
Date: Sun, 06 Jul 2025 09:45:43 -0400 [thread overview]
Message-ID: <686a7e07728fc_3aa654294f9@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <20250705150622.10699-1-nbd@nbd.name>
Felix Fietkau wrote:
> Since "net: gro: use cb instead of skb->network_header", the skb network
> header is no longer set in the GRO path.
> This breaks fraglist segmentation, which relies on ip_hdr()/tcp_hdr()
Only ip_hdr is in scope.
Reviewing TCP and UDP GSO, tcp_hdr/transport header is used also
outside segment list. Non segment list GSO also uses ip_hdr in case
pseudo checksum needs to be set.
The GSO code is called with skb->data at the relevant header, so L4
helpers are not strictly needed. The main issue is that data will be
at the L4 header, and some GSO code also needs to see the IP header
(e.g., for aforementioned pseudo checksum calculation).
> to check for address/port changes.
If in GSO, then the headers are probably more correctly set at the end
of GRO, in gro_complete.
The blamed commit was added to support tunneling. It's not obvious
that unconditionally setting network header again, instead of inner
network header, will break that.
Side-note: the number of times this feature has been broken indicates
we should aim for getting test coverage.
> Fix this regression by selectively setting the network header for merged
> segment skbs.
> Fixes: 186b1ea73ad8 ("net: gro: use cb instead of skb->network_header")
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> ---
> net/ipv4/tcp_offload.c | 1 +
> net/ipv4/udp_offload.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
> index d293087b426d..be5c2294610e 100644
> --- a/net/ipv4/tcp_offload.c
> +++ b/net/ipv4/tcp_offload.c
> @@ -359,6 +359,7 @@ struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb,
> flush |= skb->ip_summed != p->ip_summed;
> flush |= skb->csum_level != p->csum_level;
> flush |= NAPI_GRO_CB(p)->count >= 64;
> + skb_set_network_header(skb, skb_gro_receive_network_offset(skb));
>
> if (flush || skb_gro_receive_list(p, skb))
> mss = 1;
> diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
> index 85b5aa82d7d7..e0a6bfa95118 100644
> --- a/net/ipv4/udp_offload.c
> +++ b/net/ipv4/udp_offload.c
> @@ -767,6 +767,7 @@ static struct sk_buff *udp_gro_receive_segment(struct list_head *head,
> NAPI_GRO_CB(skb)->flush = 1;
> return NULL;
> }
> + skb_set_network_header(skb, skb_gro_receive_network_offset(skb));
> ret = skb_gro_receive_list(p, skb);
> } else {
> skb_gro_postpull_rcsum(skb, uh,
> --
> 2.49.0
>
next prev parent reply other threads:[~2025-07-06 13:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-05 15:06 [PATCH net] net: fix segmentation after TCP/UDP fraglist GRO Felix Fietkau
2025-07-06 13:45 ` Willem de Bruijn [this message]
2025-07-10 8:58 ` Paolo Abeni
2025-07-11 12:06 ` Felix Fietkau
2025-07-11 19:51 ` Willem de Bruijn
2025-07-15 11:35 ` Felix Fietkau
2025-07-16 15:01 ` Willem de Bruijn
2025-07-10 11:37 ` Richard Gobert
2025-07-10 11:58 ` Felix Fietkau
2025-07-17 8:20 ` patchwork-bot+netdevbpf
2025-07-17 10:18 ` Richard Gobert
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=686a7e07728fc_3aa654294f9@willemb.c.googlers.com.notmuch \
--to=willemdebruijn.kernel@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nbd@nbd.name \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardbgobert@gmail.com \
--cc=willemb@google.com \
/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;
as well as URLs for NNTP newsgroup(s).