Article View: linux.kernel.netdev
Article #14432[PATCH net-next v2 0/3] ipv6: tie the dst cookie to the lookup that returned the dst
From: Ralf Lici
Date: Wed, 11 Nov 2026 08:22
Date: Wed, 11 Nov 2026 08:22
65 lines
11719 bytes
11719 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 --- Changes since v1 https://lore.kernel.org/netdev/cover.1793806941.git.ralf@mandelbit.com/ - Fix kdoc return statements in patch 2/3. (NIPA) 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 | 57 ++++++++++++++++++++++++++++++++++++++--- net/ipv6/route.c | 24 ++++++++--------- net/ipv6/tcp_ipv6.c | 5 ++-- 6 files changed, 98 insertions(+), 25 deletions(-) base-commit: c4c470912125ec8a1a427a70f4085d8a731b00e4 -- 2.56.0
Technical Details
Message-ID:
<cover.1794384146.git.ralf@mandelbit.com>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-360913-linux-kernel-netdev=dewy.ruShow 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-360913-linux-kernel-netdev=dewy.ru From: ralf@mandelbit.com (Ralf Lici) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v2 0/3] ipv6: tie the dst cookie to the lookup that returned the dst Date: Wed, 11 Nov 2026 09:22:34 +0100 Organization: Usenet Network Message-ID: <cover.1794384146.git.ralf@mandelbit.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="808802"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:IrlI5R2Tai0LeiXMVBVr4A33sSY= sha256:6FP3yrQu3droM2TtIRonCuiLgnB91x7OQbexHxGSi8Y= sha1:Fw1rv5ynh4ThNKHpeI4W+CCLypY= sha256:6cT5dy8jNGpVAqYBXk9a/xd9jzwHpfzhl1afn6adE8M= 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 13BC0113E5B; Wed, 11 Nov 2026 11:28:17 +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=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 FvFyk2sQIbtS; Wed, 11 Nov 2026 11:28:13 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-360913-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 6857C113E54; Wed, 11 Nov 2026 11:28:05 +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 B262FC5F8A; Wed, 11 Nov 2026 08:23:13 +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=1794385375; b=uBzvMvlHtA/tgkuWBRE5cac2n4rMnBF6937xKjSmGzjhG/N1IX9+s7zz4yJvFnTrkIV8 Gx2sXOXecVg5se74xZEQJoXxC0ylHkqryyX3gkNF1byaB4zb+SEdIejTN67traRn0obms q8OUSQ+Akq+L4OkKldCSRP1ibxmNtkNlTZO9wMWM/+Ip0FCQXFq/WewSYIlrZRl5gM0KI oz3NJDcZDctaz+WLNk89kILx84/KhrgErCAF5tOJnjZJbxT7/UkNd8NGp8D8ht3nUY8jK lOeiOkGXgB9W0VQonCE8xUpf304p+EPm8arqKXTakp/PSPueWeet/Dp9WUb7tEYLRlQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794385375; 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=jOdCR7DybIvzy/7/bVj7X2472LW7lSSfULLnLbFNX14=; b=3PO7iCKIl4YTjc6TYTP6E8SL7WRzD9zR1MML09eQNFtygePdZv4jM/xDt+csZD0CHWaV nSUc8EU6CtmpEhzBPN0w2OoN8tjdOIG6RelQmq+CWLPCOvdF1g7nygWdyek+vj7AdhelL O/TBK/tOQjWxtR9H4xjaUDsPJ+H22oiDUZ/8/ZWYipexcoEgK5reg/wvrcChsXPAi/QP3 4m11aZ2TSX7e0i2nEL/9jhEIBe8DATKpSOGaCRdjJ26F7UHlRqN9KasoRtCal1tpDjMb1 +/t0ol5NhIHXRTh8u+UD55ln+9JUhwYYnYsfxtScw1iJm5KWycgPoOkjxDubvMwy26g== 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=yVrt5bP6; 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 8F9AD60A2605; Wed, 11 Nov 2026 08:22:55 +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=yVrt5bP6 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.47 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794385374; b=NvVZUiizwjhEJTlznKtsZKZ4ER3q9HdOD0uQhjx3Kysuq21BEBYQ/sqWS2PkVJAMZNsZ bamQue0kqPTnJtMcQnJtVOy3HjK4/QHVJtkYRz2Ev20IsdQTOwZPKJ1EweTYKTBGIN5Xn VlGrQQcy/5Qlb8qdAo6lfp1QoD6oHOIYz6+EQSgwQbZBfnySkXqMr4T+nEbfuwdfyvUGZ 9/OlUT+e570FWuL1Ijz/9UfDt/J+IUFuoqaT+rHlRFhIRGXe4QYYefF1l3r+obafGa68w HIWkAA/mzhVhVke0ewDTpT5dwJ0l2CnMaw5tUTdgWhIpfDrxQEn5v2KjdwllPtA9ESQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794385374; 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=jOdCR7DybIvzy/7/bVj7X2472LW7lSSfULLnLbFNX14=; b=2myYeXtSKPCMSgTyDCQXlbZlvicPQum2zw2phubWN1SiiBYU/lvD0N3Ngo3JImforSB0 xSd9uRygxNBJZKZlS5XkHtuCFnO3nIkU2ujunLuN5jJYf9WMaDIbvf2qij2QmwO4MuQ1K ibvcWxu1TqkezgCr5znv5ymwdO1/kt6oD0LFiL+gGyQhU/hswsmjlDUWbKaLXTXerN4hc C8yiqFcVouwSTZKwHnOxPudj0cb0t0yt8LyWT5sh4vngEePGioKDzZrMvX4T7OaHcDcm4 MlNZQaRrJkhl923syhZhZ9HxrvKEEPsIsY98kOgI3jawpBO3NiqtSkcP9i1bH6ltB3g== 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=yVrt5bP6; arc=none smtp.remote-ip=195.10.208.47 X-Received: from mout-b-107.mailbox.org (mout-b-107.mailbox.org [195.10.208.47]) (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 74CA4606A324 for <netdev@vger.kernel.org>; Wed, 11 Nov 2026 08:22:53 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 74CA4606A324 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 smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (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-107.mailbox.org (Postfix) with ESMTPS id 4jPc2x418nz3xv8; Wed, 11 Nov 2026 09:22:49 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1794385369; 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=jOdCR7DybIvzy/7/bVj7X2472LW7lSSfULLnLbFNX14=; b=yVrt5bP6/FzE4viGqKlsOX7wwzaCpycSeprJmjCSRj84LEkQD1Dhjt9KiKk5sqtlAW27LX ohOiyMZQmcRjTBJiA0uOw/eB/qou74J8rV52M2ENB9JERpYjJ1Y2Ri+fA1VOOhOMdngzCD 0SRyZoDSLYawX4Xy9IHTMcoAp11CXYupz7WqfS81ZkPjrF4kB47XaVdWH3u6fmSJG1Q4iP Sp19/8sFiAFLEWJfFEuANNDc74uvWJWcrdt55pUEcw+V34jboP5LWP1tOf1XprIrnALKVN d2GKzii0fvedVn1XsZZwPijTB3Dyd+rECP87XO3zhKlcIimB+1KE/RZHu/hHEg== X-Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::2 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: 4jPc2x418nz3xv8