Article View: linux.kernel.netdev
Article #17735[PATCH net-next v3 0/3] ipv6: tie the dst cookie to the lookup that returned the dst
From: Ralf Lici
Date: Tue, 17 Nov 2026 09:21
Date: Tue, 17 Nov 2026 09:21
84 lines
12763 bytes
12763 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.
I am targeting net-next to get feedback on the lookup-cookie API and its
incremental adoption before extending the conversion across the
remaining cache users. This series provides the writer-side
prerequisites and converts three socket-cache paths; it does not
complete the conversion. I am not requesting stable backports at this
stage. Backport scope and dependencies can be assessed separately once
the approach has been reviewed.
[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 v2 https://lore.kernel.org/all/cover.1794384146.git.ralf@mandelbit.com/
- Rebase onto current net-next, preserving the connected-only cache
lookup introduced by f778e80b3daf ("ipv6: fix cached route reuse for
control messages"). (Jakub)
- Move the serial update after rt6_multipath_rebalance in fib6_ifup and
fib6_ifdown. (Sashiko)
- Add Fixes tags and improve wording. (Sashiko)
- Clarify that this is the groundwork for fixing the race and a partial
conversion to the new API: other users will be covered in a follow-up
series.
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 lookup cookies in selected socket dst cache paths
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 | 30 +++++++++++-----------
net/ipv6/tcp_ipv6.c | 5 ++--
6 files changed, 101 insertions(+), 28 deletions(-)
base-commit: 6ff4c5942a301675eb12e5b49d53a81e604624a1
--
2.56.0
Technical Details
Message-ID:
<cover.1794906743.git.ralf@mandelbit.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365101-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!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365101-linux-kernel-netdev=dewy.ru From: ralf@mandelbit.com (Ralf Lici) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v3 0/3] ipv6: tie the dst cookie to the lookup that returned the dst Date: Tue, 17 Nov 2026 10:21:23 +0100 Organization: Usenet Network Message-ID: <cover.1794906743.git.ralf@mandelbit.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2290338"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:qJd1LUj8lCwxLnt9FGChfbArzuU= sha256:7/pptc5z7h2R4tOhbfLRhA+DRnDDgFvnfGNBsE0QOhc= sha1:zyhJjDrAQd12IMgn5RSuY7XyIo4= sha256:nHi2HpU42oUTktEzLIMhTyr7FvLGGN0epT0LgjrGeCc= 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 3C6B6114EC2; Tue, 17 Nov 2026 12:23:43 +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 9hyd1SdKLE8W; Tue, 17 Nov 2026 12:23:39 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-365101-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 12845114EBC; Tue, 17 Nov 2026 12:23:29 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id AC66823E8A; Tue, 17 Nov 2026 09:23:24 +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=1794907404; b=GuNPJ5LNLl/gDr52ZonJWTvEr5nxtYr9R8nuMB3bbKOme8p5Gek3H/Nz1ZjRAVtl2jO4 W10gLYff7paH3V/Iit/qOBhg64Si0e8tcd1Qirtjm8gZI3I9k8lkPU9dFmuk0xLa6PO+t rEbmnnYr4jpoPb5l8s83YQ+equ81XzfZH5GmgVu+HNwrK4F7pdIxSSG1ASvfPzwlPl+m9 7JUZQ76yZ+Smy34hjqfLc+HaVPyEoC9rLWjzr0wEjhT9MldYOpRT6Tu9D69lXUoMv9mca G5OYLGChtYsSedvTJUiRlZlK+e9mScNKRv5vlghEOgjELyYXy88HNKsHHrHuBzq0EHw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794907404; 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=fWfrKyD7qtYJoq6JoJHvtsBLIpLUMiVYweeb50Qnupo=; b=SgvSuWQQyCcDKxPBE//pN9HD8NqIZmY/DKcOaVYn0CwFtrywYXDUhSSVciyUHYHhWPPG BowhxK/PjnOKYdfqKeuqeTvn6NQeNBguDGuK2tTittEU8AjDvE0smaVzA2FvI6jpwP5M7 R7Wui288mQRnBGz5hFsxMvpqMhFdexS+A+s74aBlV0BtBOdAwDeV4aqtBj/kaVciLArWQ NbDwvE57N1XKyVD5Y2vWOsJdOhJWhObztQFaxTKGgL+rgCRAvGU5ZHcz2zsJQje1L/pXr EHjjhiS7HHPeGNuQYQanwQufnliR3a5F5QbXjutvD8t1PjUczckgXIfpnRo0ZO0YKtg== 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=YMCVe05h; 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 DC719606A334; Tue, 17 Nov 2026 09:23:23 +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=YMCVe05h X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.42 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794907403; b=c8CqQfu03NMspKYpkrJEiNUFB17QdsAEfkeu6H2iPwU4gy3mj6akoRBVwxlGmffrLOGH RCZ9QgGoc8Cn8BPCCdv6g1tF9n4scRU4b+7e3oF5m5d3D8ZrCQZJMvQeWeJE/nbdw9UPc KZL1bNReaDLdRAe7h7rYWud5VHQg7UJzrFA8pCeWumcHUExnOqxqt6SeWxyVk9QB3D4k6 hbzX1YXF03rqs5I2Y8UatDCBN7nbNRe6GhILAtMgaLAIDBoE60ehqOl++J+ZY4T0qy0xC JIRk6vDDyHXVvz3WLw9i8WdqJXGJSheCtXzwQ6wS5blE5UwVhvbHmzLi6Hbaj10MtOg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794907403; 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=fWfrKyD7qtYJoq6JoJHvtsBLIpLUMiVYweeb50Qnupo=; b=JgwJkfhLZBRK4pCFp+DVyD2syDQqnugb5bzDqzJ873jrI4SXu37p1A6+kD+HAoeMdMmP bvyGSURuZU16ruOdy3rfvd8M7XDYOsqhcvSZrK37/L6IwtcSeVTXSjv1iKuCavdj5y+J7 ftm6TRdQ+bFl4LHlo7E2yu7PV0Wlry85Ycc+VS3OuIfuAWDktMCTUEyiWOiuHB4hUgSfs Y9G2E+Hq6isrMs3CDBUl6eouP4RPLfmSzAPH3/SEdaaXak1R/sGVIwaqH1YwMGwfuoHp6 S8FhD/C3AORiNIBDUuue56upiswAHoQ7k/7C1UvOWOAjsmyaPkwjBOASyIQz9/XUuTQ== 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=YMCVe05h; arc=none smtp.remote-ip=195.10.208.42 X-Received: from mout-b-112.mailbox.org (mout-b-112.mailbox.org [195.10.208.42]) (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 87260606A31C; Tue, 17 Nov 2026 09:23:21 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 87260606A31C 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 smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (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-112.mailbox.org (Postfix) with ESMTPS id 4jTK5x0qmxz5x1P; Tue, 17 Nov 2026 10:23:17 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1794907397; 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=fWfrKyD7qtYJoq6JoJHvtsBLIpLUMiVYweeb50Qnupo=; b=YMCVe05hGlIf/wh1cR+3rQ3dHyMWbXz6W4bm8U4HGL4Wraj4M0Zl1ydGrdDQ2CsXz0Jode WGP4/fi88NuSKO9gwqrR/IZCQnlxXf8+n7lXLuhMUSrmwV6I1elkzQP8QIIGLEsM0n1TBv gLW38p0RLer1XelKamx3eisLnM/LajLFJwvwtLGcAhD8z02QvttqvbVY5jStWeHlhiAZ5g Eulnga6mXbPHF+TT3Ck35n+mLocdb6AAtDFt7UPbQocHCzMcBGmHeXapG1D31KRBGii0z9 4w2oeb5IMFt0xftJM/agUlcDjNECllfxMxGH0MKFf20cuGZKh3XTShP2DqQvVw== X-Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::102 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>, linux-kernel@vger.kernel.org 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: 4jTK5x0qmxz5x1P