🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22078

Re: [RFC net-next v2 0/7] ipv6: validate dsts against the netns route generation at lookup

#22078
From: Ralf Lici
Date: Tue, 24 Nov 2026 20:46
46 lines
11042 bytes
On Tue, 24 Nov 2026 10:15:40 -0700, David Ahern <dsahern@kernel.org> wrote:
> IPv6's finer grained invalidation of fib changes is why this whole
> cookie caching mess exists. It is a performance optimization that to me
> has gotten out of hand and as you reported is the cause of functional
> incorrectness with both xfrm and other caching.
>
> I spent the morning doing a deep dive on the claude assisted patches and
> really like the direction. Making ipv6 fib management and invalidation
> align with ipv4 should remove the need for all of the cookie stashing on
> sockets and elsewhere plus remove the cookie argument to the dst APIs
> including sockets. ie., it is a good cleanup and simplification of the
> code base with the cost of more invalidations on ipv6 fib changes.
>

Understood. My goal is to get the race fixed, so if this is the
direction you want to take, I'll drop my series. FTR, I don't think the
finer grained invalidation is the culprit here so much as reading the
cookie after the lookup instead of during it, and I still think the
per-node scope might be worth keeping (v5 shows that it can be kept with
validity in the dst), but the trade-off is yours to make.

Whichever way it goes, a few things I found while working on this apply
to your series as well, some more broadly since any FIB change in the
netns makes every pcpu dst stale:

- A found pcpu or exception dst has to match the lookup's sample,
  otherwise a lookup can return a dst rebuilt after the route it
  selected changed.
- A replaced pcpu dst released with dst_dev_put discards packets for
  holders that use it without validating it again, such as a corked UDP
  socket.
- Dropping the slot's reference with dst_release while an xfrm bundle
  holds the dst as its child can free it under a lookup that read the
  slot without taking a reference, as the bundle drops its own reference
  without waiting for a grace period. 4/4 of my v5 defers the slot's
  release with call_rcu.
- Stale exceptions need to keep their PMTU and redirect information
  instead of being treated as misses.
- The forwarding sysctl is read in ip6_pol_route before the generation
  is sampled.


-- 
Ralf Lici
Mandelbit Srl
Technical Details
Message-ID: <20261124204623.45969-1-ralf@mandelbit.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370747-linux-kernel-netdev=dewy.ru
References: <20261123212623.106153-1-dsahern@kernel.org> <20261124163553.783988-1-ralf@mandelbit.com> <72ade685-ecce-4215-a30b-25be7666e299@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370747-linux-kernel-netdev=dewy.ru
From: ralf@mandelbit.com (Ralf Lici)
Newsgroups: linux.kernel.netdev
Subject: Re: [RFC net-next v2 0/7] ipv6: validate dsts against the netns route generation at lookup
Date: Tue, 24 Nov 2026 21:46:21 +0100
Organization: Usenet Network
Message-ID: <20261124204623.45969-1-ralf@mandelbit.com>
References: <20261123212623.106153-1-dsahern@kernel.org> <20261124163553.783988-1-ralf@mandelbit.com> <72ade685-ecce-4215-a30b-25be7666e299@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="34867"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:BCFIbkpazwlpvQqtzzf5yMAmttg= sha256:oiQnXghvpWq09rC4FAr4NhXdtU0Kzrn09/RiGr3rslU=
	sha1:XZ83rkdX9rAvALcvQ8ORrEbEl2M= sha256:j1nJzeh3QRy3GhsPGxwn3ZIUWjEum47plI9dKnknPiA=
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 86950125E2F; Tue, 24 Nov 2026 23:46:48 +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 qTJ_EQgx78Rb;
	Tue, 24 Nov 2026 23:46:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-370747-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id D3E1B125E2D; Tue, 24 Nov 2026 23:46:36 +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 8EED7267CF; Tue, 24 Nov 2026 20:46:35 +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=1795553195;
	b=eF4oNyMLY9cIr6Soh40dxyYVJHMlTH+Cewtr+xr0yUoNdQGKyjYfzjFypaTjIq47482C
	 D02arSCn8UbeSn0TWgmuUlKh1Y0dI/r5ZaJ7zTRPaXuTgR2B0OWmrxDU84yu+j7RII5tO
	 cUOZxeiVHV+t8W0Gw9WxNj8bdaicdukMnm9LXu77KlRPGvKUzsUps69E332+cB2eBZTuW
	 B1cEFLEV82DvlClnXZ7SlG5hAwxWv+o4YjCuUp5QQgcTJj69cb9JJBZwo4SFoKKMuFREP
	 Auxzu0UYe1AU4+pGNHyvShR9zE35qvkKX52aHa/rSzmW/ZBOHYp3SmIuqFdcmZ4RXfQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795553195;
	h=X-Original-To:Received:DMARC-Filter: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:X-Rspamd-Queue-Id;
	bh=UiI3Y9ytEFNZ9auC1QhMx1hXzCdFx9m8tVRxBWmdnDM=;
	b=AIQYmpXR7ohyjtKj1kni8nVj1v4phGKYMqocy3sElN8llwWl+lSMOVCisZjkSSJ+twHz
	 jMkvgpsIGCabTHP2xuY5UW/Jvp7YamqTiTe4IwR4l94J3s+FCuz+U0FcbhJTXkCkvazef
	 pX6NWGIaiNNSE3oa0KXv6o5I6/g1zbfkJQ5DbU3Fi+4ZM88j9IlYkQaeixPfGZa175pjz
	 lP6vgPS8qvWt9D/7/bwV36K8pPg7U3Xe013g4CQrXBwyqKjBckNfRdzbZRaPc2WEbFUBa
	 p0LXxYe0jMerpwt5uAFkTPa/CpGkMwAr4k3u6tk07VOZ6qW3t6nKQ+goFHvfw3QGBSg==
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="nGmqpG/6";
	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 E1D5F606A330;
	Tue, 24 Nov 2026 20:46:34 +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=nGmqpG/6
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.52
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795553194;
	b=h1lIb1HcOc/Ep0fe9HbxrWVM3BjzI7Fy5U928KTUZtPdGSGBqYKknxRigA3SaDm8G8Qz
	 NmVTBS6MwVCC8Q/ub0q3qxdf3x365buko4c+Jv0UpWj0XCG/dwDRQ4OCu0HpcGdjD6GVl
	 5tqHeT07XUI8xSwYhIOZAO5DKdQbKSnk5OFtVEhd8SVLhtFXqwZsaN9hSu0u2OX3lRwYE
	 bp+HGPlyoRIH6pQWO59i1rJjdEAYQPhPYFXE6vk8mquUtR11MQPpSc9aCguR5FWCYNrfV
	 Ub0TeXQG5ofdi8o+8xTZ0cTVY92gDsngB9ywbUVsTxTspAgHVD5itLvjEvTL4hNNo6Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795553194;
	h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding:X-Rspamd-Queue-Id;
	bh=UiI3Y9ytEFNZ9auC1QhMx1hXzCdFx9m8tVRxBWmdnDM=;
	b=3PT5lFTyQJ2fosaCkO/FEN+nQYs42JujrY9TsAWKp+HVAgLQbXqHW+joovvzRXazQJqP
	 iE6j3kDWLM6DiwnhRH/BKIdWk9VNQiRCeN84d0RRoUA2tgecOQ24JEodeUI9tGtARBKE0
	 tbLaqjT9IleMdGm4e6P3u6hW5JJvNxFtw7YlmesYUhA5eq3KBNsWc1mpWnvQDr6UH90Cl
	 9L+V6zspwxqgemuNfObRr8aW8w7jYClnNnwgY6+roBBKOKd2U1qfIaDEOe1WE19Okptze
	 LplgG3ZzKVCkLBh2apnBCM0li/pIt2oIjyg4dkGC0UbZpEBEpQ+TfNsFQlPykyI/ycQ==
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="nGmqpG/6";
	arc=none smtp.remote-ip=195.10.208.52
X-Received: from mout-b-203.mailbox.org (mout-b-203.mailbox.org [195.10.208.52])
	(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 585AA606A326
	for <netdev@vger.kernel.org>; Tue, 24 Nov 2026 20:46:33 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 585AA606A326
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 SHA512)
	(No client certificate requested)
	by mout-b-203.mailbox.org (Postfix) with ESMTPS id 4jYvx13yhVzLmYt;
	Tue, 24 Nov 2026 21:46:29 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
	s=MBO0001; t=1795553189;
	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:
	 in-reply-to:in-reply-to:references:references;
	bh=UiI3Y9ytEFNZ9auC1QhMx1hXzCdFx9m8tVRxBWmdnDM=;
	b=nGmqpG/6tNDMWkYNrYANu54v2lGepgEIH2UDzSZ9c/GmxnAX50SgxOCdpaaShXfZW/2fYT
	scm+ddi6AQOyyWSB+48C5sMoXIYMGSX56O4sSehyUo7zrkReWsv0LWwbBdMaBfHd7MsHec
	oNf99RONgOPB8L3wK4AGYaSR01RshuSMTUf9bep28gsc2nLnuG3+jKL2U7X34VbSzD+5lU
	DGi8Hf64eBzv9wjSQFsWmrSn9XLLOX5vqx/kKNMhKbXinrAnYU4pThhqojl4U1frV4sCY/
	5907y9dL3LkBs7mmYJB7QCveQIegcIAVRsgh3xRokUAqoLL73T+54y330bToAA==
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: netdev@vger.kernel.org
X-Mailer: git-send-email 2.56.0
X-In-Reply-To: <72ade685-ecce-4215-a30b-25be7666e299@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
X-Rspamd-Queue-Id: 4jYvx13yhVzLmYt