Article View: linux.kernel.netdev
Article #18596[PATCH net v2 4/6] seg6: discard CHECKSUM_COMPLETE after the End.BPF program
From: Andrea Mayer
Date: Wed, 18 Nov 2026 15:02
Date: Wed, 18 Nov 2026 15:02
49 lines
12012 bytes
12012 bytes
The End.BPF program can change the packet through the seg6 BPF helpers,
for instance the SRH Tag with bpf_lwt_seg6_store_bytes(). After the
program, seg6_bpf_has_valid_srh() can also rewrite the SRH Hdr Ext Len.
With CHECKSUM_COMPLETE, the program does not always update skb->csum for
the bytes it writes, and seg6_bpf_has_valid_srh() does not either. If the
packet is then delivered on the same node and skb->csum was computed in
software, for instance by conntrack, UDP can drop the packet as a checksum
error. With skb->csum computed by the device, TCP can instead log a
"hw csum failure", as if the device had computed a wrong skb->csum.
Discard CHECKSUM_COMPLETE with skb_checksum_complete_unset() after the
program, since input_action_end_bpf() does not know which bytes the program
changed. The checksum is then verified in software.
Found by manual code inspection and reproduced in a VM without kernel
changes or error injection: with skb->csum computed by a tc ct action, an
End.BPF program that writes the SRH Tag, followed by End.B6.Encaps and a
local End.DT6 SID, makes UDP drop the packet. With this patch, the packet
is delivered. Also tested against the srv6 selftests, the lwt_seg6local
BPF selftest, and with a ConnectX-6 Lx NIC (mlx5) that provides
CHECKSUM_COMPLETE.
Fixes: 004d4b274e2a ("ipv6: sr: Add seg6local action End.BPF")
Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
---
net/ipv6/seg6_local.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index 56c6be841e53..f7e1bbc6e9f9 100644
--- a/net/ipv6/seg6_local.c
+++ b/net/ipv6/seg6_local.c
@@ -1661,6 +1661,12 @@ static int input_action_end_bpf(struct sk_buff *skb,
goto drop;
local_unlock_nested_bh(&seg6_bpf_srh_states.bh_lock);
+ /* The program may have changed the packet and seg6_bpf_has_valid_srh()
+ * may have rewritten the SRH Hdr Ext Len.
+ * skb->csum may then no longer be the checksum of the full packet.
+ */
+ skb_checksum_complete_unset(skb);
+
if (ret != BPF_REDIRECT)
seg6_lookup_nexthop(skb, NULL, 0);
--
2.43.0
Technical Details
Message-ID:
<20261118150251.65-5-andrea.mayer@uniroma2.it>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366225-linux-kernel-netdev=dewy.ruReferences:
<20261118150251.65-1-andrea.mayer@uniroma2.it>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366225-linux-kernel-netdev=dewy.ru
From: andrea.mayer@uniroma2.it (Andrea Mayer)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 4/6] seg6: discard CHECKSUM_COMPLETE after the End.BPF program
Date: Wed, 18 Nov 2026 16:02:49 +0100
Organization: Usenet Network
Message-ID: <20261118150251.65-5-andrea.mayer@uniroma2.it>
References: <20261118150251.65-1-andrea.mayer@uniroma2.it>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2626129"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:S2mc9vKWPDuXx8TYQjQNnd6P8Lg= sha256:3PjjXDKfoUn4ShxpsKDDgjUHv/jRfyF9GErDEhYoC2w=
sha1:vFlDPRSuq/FL4BvRiHSa3a2w7W4= sha256:Hr1Q5Sosy6buoaldM8X+cBNF20TfqkvNIcUd0pHU43w=
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 19EFC1152F9; Wed, 18 Nov 2026 18:10:20 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=neutral
reason="invalid (unsupported algorithm ed25519-sha256)"
header.d=uniroma2.it header.b=MtIsfFVq; dkim=pass (2048-bit key)
header.d=uniroma2.it header.b=Q0aTTieC
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 idm7A2lPFiFC;
Wed, 18 Nov 2026 18:10:17 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366225-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=uniroma2.it
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 0EF1C1152ED; Wed, 18 Nov 2026 18:10:04 +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 8F80A4185E; Wed, 18 Nov 2026 15:08:44 +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=1795014513;
b=pb4uoEFwZEmj0muzC488AEbwxXjy1r4KhdWr/4aZW8GlXjeRvP5Dsd2lwhxlB/KTm3Bc
r0T+q0zOYc94MD5BUYm/JmrV7yAZmYbJx/C905mF8az9rwHiQnPFmNLRibQnUTooyEnV7
nO5r5rQnBl3fh8ysSbNRWBrqYl94hTgkItyKJCEaOEYxibC2jGBVzCtV0CJs/whgHf6W3
JKYlrv1piilhXWnsTcx9JJF5u+jE0z7abDkJQ7TsvNOSW5f+vQkVUdLaTtOEnuVlRu+qj
Hmmwwg2PBdZsvtwhqsFUxF0rM6V9bISk+HcqIcREzG79dTDP8iiG0XL0o/XgIh64WfQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795014513;
h=X-Original-To:Received:DMARC-Filter:Received:Received:DKIM-Signature:
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:X-Virus-Scanned:X-Virus-Status;
bh=IXp1PQ0ZNJxKwPwF3VU8BniYZW9I1KwvZI5t+Y9ypkM=;
b=gmCz0ASo/RgGrTCnCHv+1OpUBXoJpFuwcnpK58TOeSWLTPy7BhEInaznKxI4kF6WZTrv
Fyqyp1eDKZN6DLychNVvTnfhWDCPvrzOs4o7Mq+I8BCVKRY8zEGQYPig6TEWzgOvE0hKU
oIsqU67ZSKmtxwFXA4/nB2mzHF62Rd4qmjk09khlc1ZP4sVEJB+hJGDj3YtKGvQOtQ0Le
AOg3CFPC7d97GPPzWhGv9uF4cs5vHgUN7qDh6npEegKnM9qpzRPeIHi2FAefRH/Oeq6eP
XUR/jkHRPQBpBpfp35vveSdtJNEeGS8wSiQCoyIkY2S0viXRg3FxZkAxiWUvLHxs9bQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=ed25519-sha256 header.s=ed201904 header.b=MtIsfFVq;
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=Q0aTTieC;
dmarc=pass header.from=uniroma2.it;
spf=pass smtp.mailfrom=uniroma2.it;
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 724CC60A2639;
Wed, 18 Nov 2026 15:08:33 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=ed25519-sha256 header.s=ed201904 header.b=MtIsfFVq;
dkim=pass (2048-bit key) header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=Q0aTTieC
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=160.80.4.37
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795014507;
b=T9l4c1qemYr67aa7Dwet5UR9SD7NYTDL27UJfJnduVel+YIjpL9S2NAMRR6ZWNI63Ewa
2cTjIqu9t3DrLfFgxJBlzY+N9fuXgGe3MokFQCNfO/2WJuEWMQNKxwA1yKqCTjqr4Ok/T
Vu1cTDubvvSelJ9Ytw1aKetHihOiw/qhvTmVlN7lqBQNuVUoaySThKBjmMwKCTQICqGpR
XHAEpraEF0yifDB0N3ImsvYV9ich56sKXcIblXziavKYThdxrCX099hSyz8ff7xpyf2hn
pYqWnux2cdd3CRGassr1WlMaOALWRPmq6m+7r4kLZjc9VeFUF5AVd9qvK8Wo5KUUbCA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795014507;
h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature:From:To:
Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References:
MIME-Version:Content-Transfer-Encoding:X-Virus-Scanned:
X-Virus-Status;
bh=IXp1PQ0ZNJxKwPwF3VU8BniYZW9I1KwvZI5t+Y9ypkM=;
b=F3sY8rK55EKElsqlPulU6IC+jSU1HI7kUfVC90ccYmHybkFL/6DReJ4Qgpxey8Jp1/cG
v2g21qbOCF5qLePtZc2iS/gYa61fFKocc2cawr58po4W66W1VAYs2KWHD0p3TZimjS53x
8BQ1iI1dE2Jfg3VHL0ExFAQUxSFzAXxBOYstDgoSIQBZ2Uhnk0ufDjzeuaLeSdQAxOmpN
xzqO2Vy9v7RTo5C/m4WJQoluZwGOTQ/MvOBp+Mog/k5Iqa4l5IfeGQMaVai1+1yNBj538
GgqmwQYJwJTFNr/9bmxyQzuhl2ji91xMFgLLPuJZlRU6GhGkdiInWh2YgZtvm7JDmGg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=uniroma2.it;
spf=pass smtp.mailfrom=uniroma2.it;
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=ed25519-sha256 header.s=ed201904 header.b=MtIsfFVq;
dkim=pass header.d=uniroma2.it header.i=@uniroma2.it header.a=rsa-sha256 header.s=rsa201904 header.b=Q0aTTieC;
arc=none smtp.remote-ip=160.80.4.37
X-Received: from smtp.uniroma2.it (smtp-2015.uniroma2.it [160.80.4.37])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A09B2606A31C;
Wed, 18 Nov 2026 15:08:24 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A09B2606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniroma2.it
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniroma2.it
X-Received: from smtpauth-2019-1.uniroma2.it (smtpauth-2019-1.uniroma2.it [160.80.5.46])
by smtp-2015.uniroma2.it (8.14.4/8.14.4/Debian-8) with ESMTP id 6AIF7YO7012192;
Wed, 18 Nov 2026 16:07:39 +0100
X-Received: from localhost.localdomain (unknown [160.80.105.87])
by smtpauth-2019-1.uniroma2.it (Postfix) with ESMTPSA id 72EE5120065;
Wed, 18 Nov 2026 16:07:30 +0100 (CET)
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=uniroma2.it;
s=ed201904; t=1795014450; h=from:from:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=IXp1PQ0ZNJxKwPwF3VU8BniYZW9I1KwvZI5t+Y9ypkM=;
b=MtIsfFVqokLTs+MjcV7pfLsLr6+pqjyXI5uLm3B4KBEzPl/XHzyV4Sd+mZiONg03p6pzMu
LO4YRUJQvJcsq8Cg==
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniroma2.it; s=rsa201904;
t=1795014450; h=from:from:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=IXp1PQ0ZNJxKwPwF3VU8BniYZW9I1KwvZI5t+Y9ypkM=;
b=Q0aTTieC9L4J4Gcv/7Gs/InoNH+1yGOUIyFR0kH/wlrmAe3uypHnM3E5TlNgfRYgQsRAbe
QCJBvFROO1rkaLHYJ7G1ZenFLHmIf4TYYMkglX2mmA5yQzQuQep2raVaji5QZd8QfX9zOh
m6hy0X0bpogjXUOMpJgdwRVFRKGLmpZ9Jrz6eo5KvfX2DUHkz/GjMDnRW/QUz5eAtKxXwf
LdSkyEICVpdHoxQXG8rdIGj7oZUKMqe6Po9VTWkYirbw6LrPMU3FTbvBBIbaqQ9N2C0D3q
dA2nvXABQiQb3C6d52bG5LV4W/XBqdmWf/4T5L+KSAJBnyILHVnZp/hw3nHYsQ==
X-Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-kselftest@vger.kernel.org, bpf@vger.kernel.org,
David Lebrun <david.lebrun@uclouvain.be>,
Daniel Borkmann <daniel@iogearbox.net>,
Mathieu Xhonneux <m.xhonneux@gmail.com>,
David Lebrun <dlebrun@google.com>, Hangbin Liu <hangbin.liu@linux.dev>,
Justin Iurman <justin.iurman@gmail.com>,
Stefano Salsano <stefano.salsano@uniroma2.it>,
Andrea Mayer <andrea@common-net.org>,
Andrea Mayer <andrea.mayer@uniroma2.it>
X-Mailer: git-send-email 2.39.5
X-In-Reply-To: <20261118150251.65-1-andrea.mayer@uniroma2.it>
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-Virus-Scanned: clamav-milter 0.100.0 at smtp-2015
X-Virus-Status: Clean