🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #8252

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

#8252
From: Eric Dumazet
Date: Wed, 28 Oct 2026 14:13
58 lines
10082 bytes
skb_gro_flush_final_remcsum() calls skb_gro_remcsum_cleanup() to undo
the checksum adjustment done by skb_gro_remcsum_process() when the
packet was not consumed by GRO.

When the inner handler merged the packet (NAPI_GRO_CB(skb)->same_flow
is set), skb->data might have been moved past the headers:

- skb_gro_receive() uses __skb_pull(skb, offset) before adding the skb
  to the frag_list of the held packet.

- skb_gro_receive_list() uses skb_pull(skb, skb_gro_offset(skb)).

grc->offset is relative to the original skb->data, so the 2-byte
read-modify-write done by skb_gro_remcsum_cleanup() can land in
the payload of a packet which now belongs to the GRO packet.
pskb_may_pull() can also be called on this frag_list member.

With fraglist GRO, this can also be a use-after-free:
pskb_may_pull(skb, skb_gro_offset(skb)) in skb_gro_receive_list()
or udp_gro_receive_segment() releases the first page fragment if it
only contains headers. NAPI_GRO_CB(skb)->frag0 and frag0_len are not
updated, so skb_gro_remcsum_cleanup() takes the fast path and writes
through frag0 into a page the skb no longer holds a reference on.
The non merged case, where frag0 is used after this pull, is handled
in the following patch.

Headers of a merged skb are not used anymore: the skb is either freed,
or its headers are rebuilt from the head skb in skb_segment() or
skb_segment_list(). Skip the cleanup in this case.

This affects VXLAN and GUE with remote checksum offload enabled.

Fixes: 26c4f7da3e41 ("net: Fix remcsum in GRO path to not change packet")
Tested-by: Cen Zhang <cenzhang@linux.microsoft.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
---
 include/net/gro.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/net/gro.h b/include/net/gro.h
index 2300b6da05b2728ec40f42228f8fa9c195d8479c..b560e866683b03314b3e80a887ac4467d1a5acb9 100644
--- a/include/net/gro.h
+++ b/include/net/gro.h
@@ -351,7 +351,10 @@ static inline void skb_gro_remcsum_cleanup(struct sk_buff *skb,
 	void *ptr;
 	size_t plen = grc->offset + sizeof(u16);
 
-	if (!grc->delta)
+	/* Once merged, skb->data was moved past the headers, and
+	 * the headers of this skb will not be used anymore.
+	 */
+	if (!grc->delta || NAPI_GRO_CB(skb)->same_flow)
 		return;
 
 	ptr = skb_gro_header(skb, plen, grc->offset);
-- 
2.53.0
Technical Details
Message-ID: <20261028141325.2103814-2-edumazet@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352874-linux-kernel-netdev=dewy.ru
References: <20261028141325.2103814-1-edumazet@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-352874-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 1/2] net: gro: do not undo remote checksum offload on merged packets
Date: Wed, 28 Oct 2026 15:13:24 +0100
Organization: Usenet Network
Message-ID: <20261028141325.2103814-2-edumazet@kernel.org>
References: <20261028141325.2103814-1-edumazet@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1785329"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:mDWEpJwUq8FwT12SVpVjChptz+k= sha256:Lgx5P0nbSAN3GkkkQ9YkxojqH9gEW1/rvX041FRLDbA=
	sha1:O5GZtbQrxp5uEdHgoLy84JGmB8k= sha256:uiHdfXqBJHL8A3lQxG3sHKD7fVHYKIe2U7j5Ee2HDqM=
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 E7CEE125C36; Wed, 28 Oct 2026 17:14:21 +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 2rgCyb_MbxvG;
	Wed, 28 Oct 2026 17:14:19 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-352874-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id E4A2F125C35; Wed, 28 Oct 2026 17:14:10 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 463382810A; Wed, 28 Oct 2026 14:13:36 +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=1793196814;
	b=QYinAJbiQCT/cvWwl8SV2yug53d3UKltY9CFzkwQkDayB06LH1iv05arxRBdFchYG7LY
	 B62Z2JdSweQ4URRbn/TG3kXG0+5tyz59/m0Ck6umpa4bZ4ZUqAuQmn9crqgg+XxqstII8
	 VEC4yK7LQvHXmuq4e3KOgT9fNRwG1ADuGhZcE2EWB0Ryl0GtePG2dgtv/QqjxrRw+CGNQ
	 b8S6yD7uKchnhT823pV4HqPFncYZMgxUr+VFwLDysASdCDBkzDusPnZo/KA7JKcJXOWbY
	 Hyoj8n7H5uQgtfXE6NMGv0Kzj1VroGH55IbXMk5ftqDDYkgG3dNMDgwkpY3QAEw6JgQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793196814;
	h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding;
	bh=cB7rYoNo0LqZe8zAkmS4kIYgrBoAJBjqJBOLwdbnCZs=;
	b=MBPzT3jexb5jXrrHmsa9ApM0r+yzkFc3/fVCoFsqax36k99D5LBjY4g4In2KbpbKutIH
	 WqHT1+e3o/VC/Iwk5KHYNLwiUeTtuCJQGRIU7VqOs4yGO0ufVm0dgQlfWOfSi8d0+fimN
	 CePYvYl25sDBuHvNrHEzCXfkX3HSoyem7+6bOb/Lvw/B5IX/6DkhM7jYaNPPG4PJLUxaO
	 m2PHNSdOZJDJYRA4n7J4vxPAGOqfQb+08AdUeIJQpgDs9QHl0RhhhPVzDbjOERZYd6uiL
	 e9lmcVn5pqSEU9LbIU/8xrGxKqL1JIGSAKq8oCXofVPCLZMFO2LcLhBA9bo1LZ6OAYQ==
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=an8TKsCx;
	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 4738B606A31E;
	Wed, 28 Oct 2026 14:13:34 +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=an8TKsCx
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=1793196813;
	b=RTJgHk48Z763VErkjCO8its5drDK6xbCmqNiysnl00SD8hEb88VpdYHPVPImekyr1cbr
	 oI7YzsmkW0JEv6svSWKsFUh/Y/s2yNUIoPx6zKMVjyE/N2nnd77pj+jTlDtLVxQ4Lsbjn
	 g+tr+sklqojPLayTTgNXRXg5hw4SeJzT1tp9WYEks+B4o+6AswNaPV8fM8s7U710z8U74
	 l1NbVz8vnOABr+wONrctcoPyovbDxxdhNhSDeQIS0W3i7jYWHW895ZwN0s1U0zFSqJn1v
	 URC5n776JL9P2DjoIXlOwXzwkTWPiLUP7TqqfSV1fbfqV9hsMC8VwC9zYsxhwJeM6fw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793196813;
	h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 In-Reply-To:References:MIME-Version:Content-Transfer-Encoding;
	bh=cB7rYoNo0LqZe8zAkmS4kIYgrBoAJBjqJBOLwdbnCZs=;
	b=5Kbo7qyFN6SYG9alKnBh87wKL211OhetFdOweRX2WISln3HRdUyhIToPfezCvsyAeJNU
	 i03iPqQc6KKt+R5aqt/aJ0ZSeDhSTDV0beaq+xuTNp/1GpEn+Do4tvilyRY7gjqLrGqMx
	 GfBOA5bNK2sbg8xJtPHZWE4Czcp+b+L/BkIQ7Cf6F4x7yAyEjA2zdNmJr5nsoDx+qkSat
	 AsEvIdT9SH6z/k5MiornF59jpxr/+J6oL40h9+AxH9JzUr1wHgPSOQW1pojYRFJdPF3l0
	 eahSErr//j5Aeia7UoKYDsfuHQOr1g3XX4SQZZGkrI/WBAHVFDarQ3bVE6dn0vmrxdQ==
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=an8TKsCx;
	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 28556606A31C
	for <netdev@vger.kernel.org>; Wed, 28 Oct 2026 14:13:33 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1E681F01828;
	Wed, 28 Oct 2026 14:13:30 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793196812;
	bh=cB7rYoNo0LqZe8zAkmS4kIYgrBoAJBjqJBOLwdbnCZs=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=an8TKsCxohXQsfZptlP0O2cRqZRATWhX9x0gIGeyH1ywVhNryi3KA9ZK3C5SjW4qb
	 8GfyWOQdvk4QAtp85QKD9c476fl00aUefZBc6a6MEGT/jpRk9qGJuznLX0YQBzQ9/C
	 /ArbUV058DnUQzSglL5pCU3vyWCHvJ+zve7HpvoT7q8XYxJga5DtQDhlA34dRqECt3
	 0SxS0A6wrfpT3b6tM+Tl+fTBKVZuggYyEOVzROArMGokecu3APdg4FdxqJ7tewVw7W
	 LH0Qb4CuWe7Zk9YT8JgztijmWB/zatec8u1ytPLSKe3GxflBwYXtmv/sQb6eDdfA6S
	 xcSfsOwoNqaYQ==
X-Cc: Simon Horman <horms@kernel.org>,
	Willem de Bruijn <willemb@google.com>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	AutonomousCodeSecurity@microsoft.com,
	netdev@vger.kernel.org,
	edumazet@kernel.org,
	Cen Zhang <cenzhang@linux.microsoft.com>
X-Mailer: git-send-email 2.53.0
X-In-Reply-To: <20261028141325.2103814-1-edumazet@kernel.org>
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