🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #11055

[PATCH net-next 0/3] ipv6: tie the dst cookie to the lookup that returned the dst

#11055
From: Ralf Lici
Date: Wed, 04 Nov 2026 15:53
62 lines
11560 bytes
Hi,

This series implements a first part of the model proposed in [1] to
address the late cookie sampling race: a dst can be stored together with
a cookie read after a FIB change that its lookup did not see, and then
passes dst_check until the next change.

The case that made me post it as a series is xfrm. Adding a policy
restamps every fib6 node, so a socket whose lookup ran just before the
insertion keeps its plain dst and leaks plaintext although the policy
matches. I reproduced it for TCP connect and connected UDP, and the same
window lets a more specific blackhole route be bypassed for routes using
nexthop objects. The ovpn patch [2] hit the same pattern in
dst_cache_set_ip6.

The conversion is initially limited to tcp_v6_connect,
ip6_datagram_dst_update and ip6_sk_dst_lookup_flow. Other TCP TX cache
paths, including established-socket route refills, header rebuilds and
accepted-socket setup, still use late cookie sampling. This gives the
lookup-cookie API a small set of users and concrete fixes to review. If
the approach is accepted, I plan to follow up with a broader conversion
across the networking core and drivers.

Compared to [1], the fallback cookie is 0 instead of the pre-lookup
generation, so fib6_flush_trees is left alone, and nexthop-object dsts
are checked in ip6_dst_check instead of passing the generation down to
ip6_rt_pcpu_alloc. The other cache users (dst_cache, sctp, ipvs,
flowtable, sk_rx_dst, the xfrm bundle cookies) are not converted and
behave as before.

I tested it in a VM with lockdep, PROVE_RCU and DEBUG_ATOMIC_SLEEP,
using a debug-only delay after the lookup to hit the window: no
warnings, and the plaintext and blackhole bypass are gone in these test
cases.

[1] https://lore.kernel.org/netdev/20260901122501.482920-1-ralf@mandelbit.com/
[2] https://lore.kernel.org/netdev/cover.1789639346.git.ralf@mandelbit.com/

Thanks,

Ralf Lici
Mandelbit Srl

---
Ralf Lici (3):
  ipv6: stamp the default route node with a fresh serial on link failure
  ipv6: add ip6_dst_lookup_flow_cookie
  ipv6: use the lookup cookie when caching the dst in sockets

 include/net/ip6_route.h | 18 ++++++++++----
 include/net/ipv6.h      | 13 ++++++++++
 net/ipv6/datagram.c     |  6 +++--
 net/ipv6/ip6_output.c   | 55 +++++++++++++++++++++++++++++++++++++++--
 net/ipv6/route.c        | 24 +++++++++---------
 net/ipv6/tcp_ipv6.c     |  5 ++--
 6 files changed, 98 insertions(+), 23 deletions(-)


base-commit: 7b6ab4dbc156e2f96419715130b3d5738a306c93
-- 
2.56.0
Technical Details
Message-ID: <cover.1793806941.git.ralf@mandelbit.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-356571-linux-kernel-netdev=dewy.ru

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-356571-linux-kernel-netdev=dewy.ru
From: ralf@mandelbit.com (Ralf Lici)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 0/3] ipv6: tie the dst cookie to the lookup that returned the dst
Date: Wed,  4 Nov 2026 16:53:28 +0100
Organization: Usenet Network
Message-ID: <cover.1793806941.git.ralf@mandelbit.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3423602"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:w79n8dJO7fx5ffe3EZFwL35iSEM= sha256:13OHINSx7fSbr3NnIRYThsSgPi8f4pPOufJE2xsaEMM=
	sha1:nXdhwg8OPyEjgx1v+quFK2GHohY= sha256:MZoJ0GXpjP5wvnPZjH8g4CSz+bsVxo+rXL+XU+tk6ns=
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 97562112C46; Wed,  4 Nov 2026 18:55:00 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.15
X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31
	tests=[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=pass (2048-bit key)
	header.d=mandelbit.com
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 JoeEcvAqmziT;
	Wed,  4 Nov 2026 18:54:57 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-356571-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 1E0F6112C24; Wed,  4 Nov 2026 18:54:49 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 91847609A2E; Wed,  4 Nov 2026 15:54:23 +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=1793807654;
	b=vs/AqtroH/zhXsB27hz+SZBFyVht05cQ3LjMH23IrYGcl2YGiOlk1mJtKKVcLKWb/t9k
	 uSxyhNh9Sl0/BE4Cfdb/YZcEZK/wDhS26sJWHAn2GsVPJ6hhBhfR2DSCSr+bwg4wGyesx
	 zt7qe+JRRTOPc4Af0JKyAAPzzrJUkNt6D0hWHMP/7a5wcCGqkb/E/nNA2qDrnJFb7y5xY
	 HwUQ0LC1Qd/w0Er/vdSkDefhNcyKeIhDqsDUbvC9qfTqaRxYVm3AiTqH5AIQDvXbxcKyY
	 qi8KTUU59eUk6azp9VveJi0RbHtqSTdCRMWvIhVLZaH8JN+rpTIYXf8recROBoGEvEg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793807654;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To:
	 Cc:Subject:Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Transfer-Encoding:X-Rspamd-Queue-Id;
	bh=3ZyKVlgETx/e5PJXK1nIzrIGfB7mow/Rq5EMyqi1gw8=;
	b=nz03U2OlsxMIMaILoqhwHF9zC1zEloylD/UsKjPnPrAq+usYX4hZtn0r7PLTk6ReFhoK
	 17YAxIsg8kpSprf4ZH6O9f7ydATSgpAmopLMq/K4vnMsVZjFzkljCBkW9XVDmN7YwLTCA
	 XSx5PUSEFaeSAiG1AOJkUJRkvejrxe/dtznmlcGLQzYDkIwaO+qtLfnz6XaEds+xoFBuC
	 rwLJhap3Fobz0p6I75yGHDzK4Sf4zLUAO7fLBcrHz3+v/dldsSjYsfn33xYSGPgZL8WXP
	 JHYXM3yDr0hItbDC+cBnAwByNRZyEe2/z+lC67rUkLJnfBex+akNZPg5LxXphTKXfgw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b="E0ixl/Yi";
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.com;
	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 548CF606D802;
	Wed,  4 Nov 2026 15:54:14 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=E0ixl/Yi
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.46
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793807653;
	b=WMybuL4SXQEXDkK8US36sAWW7updNX1rqzuha9UZwqwpwUKZ3ofAQnoiL88tRDbGWgX9
	 5QKPwggldhejxiT2U5rWkTfV+CoUeSOsDlyqIZ4mVgY84FPcsHjymJKxDvTBzYGRqK9ku
	 IPNRvbjMjQeEeXeEAo347xX4ciaJmBPSSNnv0FJDyNqxskpBmetPrs+s6KQRt9I88l5DH
	 VdVWPtz0/XARP9hBmEJnl0BIXAae+HJvMLmeJxVs0cCn/WWO2MgKQXGrUseQMPTYCmGV9
	 sIXr/MmldTmrq0+GJXCrBlTUrT8a6smJrUS2FKOGJMzKTWly9XZF7XXaBzieW7Lg0Vg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793807653;
	h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding:
	 X-Rspamd-Queue-Id;
	bh=3ZyKVlgETx/e5PJXK1nIzrIGfB7mow/Rq5EMyqi1gw8=;
	b=oVIabaDKY7s6Jh4PV4HTRu5jcsS1ulghkm5uPiUj0pV/tmw39Vx0x4cL2Pi2wetRuEes
	 uHJLJZ2dbIqpb8TVOvlzxO1DDBvKer/qxM0dpIVjE06EhVJlPvqkkHl36BQ/NEcjWwcuJ
	 jIUE6hb2toVX8KOlPWN2VrZ7Oc/27YBDTpiN0nU6GmQTQLk5+U7axfqTWiSsRdF7D84WK
	 57B0NqChX8Gc67KMR+JNpUN6h4n1WYXFTsjY4sn5871JSZigRuXnpl5c9fE1HdwZu3tsp
	 KiNmtZC5YNpTDusPSsbEbUYhrjogDbYzZwReSXw5b1Nq0KA3q2dpBwTavyFdDbNZ+fQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.com;
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b="E0ixl/Yi";
	arc=none smtp.remote-ip=195.10.208.46
X-Received: from mout-b-106.mailbox.org (mout-b-106.mailbox.org [195.10.208.46])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92E94606A330
	for <netdev@vger.kernel.org>; Wed,  4 Nov 2026 15:54:07 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 92E94606A330
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com
X-Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by mout-b-106.mailbox.org (Postfix) with ESMTPS id 4jKVNj5Ts8zNltw;
	Wed, 04 Nov 2026 16:53:57 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
	s=MBO0001; t=1793807637;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding;
	bh=3ZyKVlgETx/e5PJXK1nIzrIGfB7mow/Rq5EMyqi1gw8=;
	b=E0ixl/YinGNQhnB4ZG2o2Rf0sU+Lyv3QubVHY8S8j8NLzppnoFQEeatuXGOfMcV+aCgphn
	b1JxhZxjRujM8R1lOjVyaKT2EtI/CbVhtCrZkQ8H28f9wtgbIjGUlly2t68Zm/IsZJCvmI
	hs8HHkbNmcd6p/Di3CecT9mJewiozjn+5uGOeGYSgcUdRaBH9G8lnRMlFLyZNBrtALJOsI
	D8CBcf+je7hCOxw9gVIlEugVcXCoUteDSpv+Qwq1JxVl6loqfI2mcJE3Rt033azAO5/onV
	Jnt2N15PC0s0jujvw6CRMZLfHLiyCARBlhmTMjWIcPT+vHfEv5+osK35wUuDew==
X-Authentication-Results: outgoing_mbo_mout;
	dkim=none;
	spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::202 as permitted sender) smtp.mailfrom=ralf@mandelbit.com
X-Cc: David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Neal Cardwell <ncardwell@google.com>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Florian Westphal <fw@strlen.de>,
	Sabrina Dubroca <sd@queasysnail.net>,
	Antonio Quartulli <antonio@mandelbit.com>
X-Mailer: git-send-email 2.56.0
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-Rspamd-Queue-Id: 4jKVNj5Ts8zNltw