🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #11027

Re: [PATCH net v3 1/2] net: gro: do not undo remote checksum offload on merged packets

#11027
From: Eric Dumazet
Date: Wed, 04 Nov 2026 15:09
141 lines
14685 bytes
Le mer. 4 nov. 2026 à 15:00, <netdev-bot+sashiko@kernel.org> a écrit :
>
> 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] For VXLAN, the new fraglist branch in skb_gro_remcsum_cleanup()
>   (include/net/gro.h) breaks inner checksums when the VXLAN packet is…
>
> --
>
> net: gro: do not undo remote checksum offload on merged packets
>
> This patch changes skb_gro_remcsum_cleanup() so it no longer undoes the
> remote checksum adjustment on packets that GRO merged. Fraglist members
> are the exception: their original inner checksum is restored in the
> headers pulled by skb_gro_receive_list(). The goal is to avoid stray
> writes into payload, or into a freed frag0 page.
>
> > diff --git a/include/net/gro.h b/include/net/gro.h
> > index 2300b6da05b27..13a8ef217a1d7 100644
> > --- a/include/net/gro.h
> > +++ b/include/net/gro.h
> > @@ -354,6 +354,23 @@ static inline void skb_gro_remcsum_cleanup(struct sk_buff *skb,
> >       if (!grc->delta)
> >               return;
> >
> > +     if (NAPI_GRO_CB(skb)->same_flow) {
> > +             /* skb_segment_list() keeps the inner headers of fraglist
> > +              * members: restore their checksum. skb_gro_receive_list()
> > +              * pulled these headers, then moved skb->data past them.
> > +              * A valid remote checksum offset points to the inner
> > +              * transport header, which is part of these headers.
> > +              * Headers of other merged skbs are not used anymore.
> > +              */
> > +             if (NAPI_GRO_CB(skb)->is_flist &&
> > +                 grc->offset + sizeof(u16) <= skb_gro_offset(skb))
> > +                     remcsum_unadjust((__sum16 *)(skb->data -
> > +                                                  skb_gro_offset(skb) +
> > +                                                  grc->offset),
> > +                                      grc->delta);
>
> [Severity: High]
> Restoring the sender's checksum on fraglist members is correct when the
> outer VXLAN packet is forwarded unchanged. Is it also correct when the
> packet is decapsulated locally by VXLAN?
>
> The VXLAN socket accepts fraglist GSO packets:
>
> drivers/net/vxlan/vxlan_core.c:vxlan_create_sock() {
>     ...
>         udp_allow_gso(sock->sk);
>         return sock->sk;
> }
>
> Because of this, udp_unexpected_gso() returns false for the
> UDP_TUNNEL|FRAGLIST|TCPV4 aggregate. udp_queue_rcv_skb() then passes the
> whole aggregate to vxlan_rcv() without segmenting it.
>
> The decap side then adjusts the checksum only once, through a pointer
> into the head skb's linear data:
>
> drivers/net/vxlan/vxlan_core.c:vxlan_remcsum() {
>     ...
>         skb_remcsum_process(skb, (void *)(vxlan_hdr(skb) + 1), start, offset,
>                             !!(vxflags & VXLAN_F_REMCSUM_NOPARTIAL));
>     ...
> }
>
> include/linux/skbuff.h:skb_remcsum_process() {
>     ...
>         delta = remcsum_adjust(ptr, skb->csum, start, offset);
>     ...
> }
>
> Nothing walks skb_shinfo(skb)->frag_list. So after this patch, each
> fraglist member keeps the restored sender checksum, which is not a valid
> final checksum under RCO.
>
> iptunnel_pull_offloads() removes only the encap GSO bits, which leaves
> SKB_GSO_FRAGLIST|SKB_GSO_TCPV4. Suppose the decapsulated inner packet is
> then bridged or routed out a device without FRAGLIST support. In that
> case skb_segment_list() reuses each member's own inner TCP/UDP header.
> __tcpv4_gso_segment_list_csum() also leaves the checksum alone when the
> addresses and ports match:
>
> net/ipv4/tcp_offload.c:__tcpv4_gso_segment_list_csum() {
>     ...
>         if (!(*(const u32 *)&th->source ^ *(const u32 *)&th2->source) &&
>             iph->daddr == iph2->daddr && iph->saddr == iph2->saddr)
>                 return segs;
>     ...
> }
>
> Would every segment except the head then leave with an invalid inner L4
> checksum? This path needs:
>
> - a remote sender setting VXLAN_HF_RCO
> - REMCSUM_RX and REMCSUM_NOPARTIAL on the VXLAN device
> - rx-gro-list on the lower device
> - no local socket for the inner flow, so is_flist gets set
>
> Before this patch, with frag0-based drivers, the member's linear header
> kept the adjusted checksum, which is valid for this path. The stray write
> went to the stale frag0 page instead. The commit message does not mention
> the local decap case.
>
> GUE does not seem to be affected. FOU/GUE sockets do not call
> udp_allow_gso(), so the aggregate is segmented before gue_remcsum() runs
> on each segment. The follow-up patch "net: gro: invalidate frag0 after a
> pull" does not change this logic either.
>
> Could fraglist GRO be refused or flushed once a NOPARTIAL remote
> checksum adjustment has been made? Alternatively, could the VXLAN decap
> path adjust the frag_list members too?

Yes, the checksum of fraglist members can not be right both for
forwarded packets and for packets decapsulated locally.

In v4, skb_gro_receive_list() refuses skbs with skb->remcsum_offload
set, so fraglist members never carry an adjusted checksum, and
skb_gro_remcsum_cleanup() simply returns for merged skbs.

pw-bot: cr
Technical Details
Message-ID: <CAL4WiipYthA7wwfuk4xU0OQaW5No11XXRG5HwFxNeMfMnA8ucQ@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356526-linux-kernel-netdev=dewy.ru
References: <20261103105752.49542-2-edumazet@kernel.org> <179380083642.488856.12336059973220391773@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356526-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3 1/2] net: gro: do not undo remote checksum offload
 on merged packets
Date: Wed, 4 Nov 2026 16:09:08 +0100
Organization: Usenet Network
Message-ID: <CAL4WiipYthA7wwfuk4xU0OQaW5No11XXRG5HwFxNeMfMnA8ucQ@mail.gmail.com>
References: <20261103105752.49542-2-edumazet@kernel.org> <179380083642.488856.12336059973220391773@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="3416253"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:AXIbFgCTzkt0goxopc5AtejFYFM= sha256:eGan27MwTLISOebCbCC6w/NS8tqQF7NMHqYAM5VE+yY=
	sha1:Q64/HhBTftYi6PYkK/kQ2iK8WaM= sha256:DzEHC7rhBbY03tBpbY2YjKTCPpLSeo4X0MYzsfPyCVc=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 43B51112C23; Wed,  4 Nov 2026 18:11:11 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id CEL0Ovqfg3_2;
	Wed,  4 Nov 2026 18:11:08 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-356526-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id A4FE0112BEB; Wed,  4 Nov 2026 18:10:58 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 8511F35161; Wed,  4 Nov 2026 15:09:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793804962;
	b=icWyTllLO5gYmlnVRy9ft+zDVde2f36TQ4O1p/9UCxzyYoYbHoyx24RzqqcJScdkf6Tk
	 R4dAKgwLdVtn2xUdpG6dYsUIZYwKs8p1JC7FitW+4CtilILYIKthw4zWc33YVMikWrFz6
	 wwzm+4tmqd5tyFNjEDlHXQGpS0BxDanEnF+onywq9nk4NaGb2u6rNMy8XxD/gKHTQ4XIm
	 Kz2Lnm/VzaOMd0nqgO5hYXqXmQ3DFp1FqCorxH0SIrH2XcpvrXPROvQWZu/6SW87Uoc54
	 RYwdqHP/aniY+hAlBveY/KL818zpKRtuFI2pgE9OJrp2/0r7jn93VX7z56wRhviYJog==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793804962;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:References:In-Reply-To:From:Date:
	 X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
	 Content-Type:Content-Transfer-Encoding;
	bh=PZ9W5jMyXKX3yUIRHeeF4bKkSid+UAfYqLNNsUE71VU=;
	b=eHuz6oop6yedT0wyt8X2fNdd1hSDkd24I533sKUCfMHidpePW1NiwvroYuhXebkhPMGr
	 vHPqqzTRckLxCaHp8MqSeLDl3h3kcE//HzpwA0JtoxaYcUebWIpfDC8cAgsmWGZZmXNi7
	 Z7vfadpGMckNLV4lttQer12fS3fDRi4mkKacaLpA2sA4ypcme6fshuyleHVdvdiay56PB
	 7SqYJSDfY4catOQYDDEybZzR35XBp78e5cGJr5aOkU30LYUstHOVqhXd8+kaNXK+fK1rx
	 FwJtBPzeVG0wXtTH4p8DBK7+RhAfP/uVQt90x92dOnJJ3yRMJI3oxoLuERDGZA8MT/w==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jZJ9Vj+E;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B45F606A336;
	Wed,  4 Nov 2026 15:09:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jZJ9Vj+E
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793804961;
	b=5bycbt4CfRAifutS+v0Lij9DNiBv9BSwZAu9RVyL9NpNivnNcyc9SpPL6FDYQr7v3e1X
	 5BcZdgE+oJ8AeJ0z+na3djnRQ9OrpGjSZpPvHBUFqM/YO5AQ1aI4Z7XfL8qTEz71co+Cp
	 DpQiYC09LMpFZhQhUEflGjxs0VqnPRoeMnxSUTzn3L86B3lwcjoEFR3kBVUfrVe994DOD
	 FB9a36P+Xd3JGPQ/bt9ZKz5uL+ZTuVmfN9Ajslo0wk02ZfhC2ie9aVLxVThS6aaxEvufN
	 cjqOfxi4Qc8gXMJfR781t/j6wlH7a9lkllIDv5xWLCUW1QMDNADyyOPfD/gmMj4GKrw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793804961;
	h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted:
	 X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To:
	 From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:
	 Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=PZ9W5jMyXKX3yUIRHeeF4bKkSid+UAfYqLNNsUE71VU=;
	b=p1C3xUudvsfme4HFLSFRSpXk0FcFxoCg3bVqQrpREXfF+45vHB6c8/79QOSBpzL8+YoT
	 KhLWmVZMJ3GL51K1/7bSX04MhHwIfKa9wTJgQSsMvt4hHb1oTijHoNvGftf21f7Cg8lju
	 x2rRESRAsIMcGQSXaz/eWekd+wPG6OYtL5EnE+hMUuRmii+vTaS1CeYi+I3dwL1QZx8M0
	 0E/qow72VIBqo9VWrV47Y6TwUsaWIGZyWFuQ/IX2OPoAnoNlsrLvM7nzLuhCUJ8AT8LA+
	 T9EPO0uDaOGE2he+Nohj8NFX9jhbXT/5kqxkv6lSh0wZsscJ1VxGKmWBemVe6bocVdg==
X-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=jZJ9Vj+E;
	arc=none smtp.remote-ip=100.103.45.18
X-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 33784606A32D
	for <netdev@vger.kernel.org>; Wed,  4 Nov 2026 15:09:21 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 102B41F00A1D
	for <netdev@vger.kernel.org>; Wed,  4 Nov 2026 15:09:21 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793804961;
	bh=PZ9W5jMyXKX3yUIRHeeF4bKkSid+UAfYqLNNsUE71VU=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc;
	b=jZJ9Vj+EUsOKcs5AaAMaejgBs1wmEyEZhvVFxEM2EXkz/sOghQPbZX1fgLOpKb+wv
	 cw2W4vj/g2HmZRwZrnoyy/YZmEeJ8pLFNfXJ9763YjnorHl3/smo8LkyoX5gSNvg5p
	 LwmJjNaFHtDUFcus+sw/NWLAazQ0TQUywmfZcJHSUYlrSBtgBDETxjAuZZoc3PbXTG
	 6FnY3d4qbcUjXNRQTRLh+DPWoJcpf4H5Q0FAhxNBsa+3nmJq2O4qrF5a3HmQXcr75l
	 sb4OsmlZeQmrKEhbaiYl1bkg78K2vnXSkLNpVr/PaB7mgxzLSX/ZohBORDEn7XjO2x
	 SU5yUk+vbLEHA==
X-Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-4a75a5fa32dso244154fac.1
        for <netdev@vger.kernel.org>; Wed, 04 Nov 2026 07:09:21 -0800 (PST)
X-Forwarded-Encrypted: i=1; AKwUvBySwEDX71FToCW/zX2LN5LI9SoGIbwrUliFcoGm01YSUZvppXVingHWuPodS519Jf/KJ+9ooEs=@vger.kernel.org
X-Gm-Message-State: APuU4Z+AVNP4bTCTBYct5ZDdSZeNfP5HiH2pCLEu2rXfG1Vg1dF5eUt1
	9vIatRxYXPj4V3+yjGyxvr3mXWoCbTmkIW+itYGQQQeskT6PJIZ8Bh42TT/a/hSJjj1h3f4dcTU
	MdI8k1aSdv/Qv4rcZrFoY8gmz8WdKbkU=
X-Received: by 2002:a05:6870:c0d0:b0:449:bccf:bb6e with SMTP id
 586e51a60fabf-4a9072eed47mr9411537fac.7.1793804960254; Wed, 04 Nov 2026
 07:09:20 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <179380083642.488856.12336059973220391773@kernel.org>
X-Gmail-Original-Message-ID: <CAL4WiipYthA7wwfuk4xU0OQaW5No11XXRG5HwFxNeMfMnA8ucQ@mail.gmail.com>
X-Gm-Features: AclHuK98ebxXGkgNQALWUk96fG91psaFgnvdDfUzdKl-qYDRdANoT3i1s2uQNko
X-Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, 
	netdev@vger.kernel.org, willemb@google.com, steffen.klassert@secunet.com, 
	tom@herbertland.com, cenzhang@linux.microsoft.com, 
	AutonomousCodeSecurity@microsoft.com, stable@vger.kernel.org, 
	tsgatesv@gmail.com