🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26511

Re: [PATCH net-next v3 00/13] ipv6: validate cached dsts against the netns route generation

#26511
From: Ralf Lici
Date: Thu, 03 Dec 2026 16:55
60 lines
11350 bytes
On Thu, 03 Dec 2026 17:34:47 +0200, Ido Schimmel <idosch@nvidia.com> wrote:
> So, I think Ralf's v5 [1] is a better approach and also easier to
> review: Keep the per-node validation for inline nexthops and per-netns
> validation for nexthop objects.
>

Thanks Ido for the review, and thanks David. I'll respin my series with
your comments addressed.

> A few comments on his series:
>
> 1. "ipv6: stamp the default route node with a fresh serial on link
> failure" is not strictly related to the other patches and should be
> submitted separately and without a Fixes: tag given this is not a
> regression.

Will do, ahead of the series, since the ordered comparison below relies
on node serials never going backwards. I'll also drop 2/4, which was
merged in net in the meantime.

>
> 2. Invalidating live per-CPU dst entries by calling dst_dev_put()
> introduces the same problem that was fixed in IPv4 by commit
> 5018c59607a5 ("ipv4: fix race condition between route lookup and
> invalidation") and commit ae89f2724db1 ("ipv4: route: don't blackhole
> in-use routes when retiring fnhe routes").
>
> Better to move these dst entries to the uncached list, which requires
> handling [2] first.
>

Agreed. I tried putting replaced pcpu dsts on the uncached list before
posting v5 and dropped it because of the ownership problem you describe
in [2]. I'll start the series with the change you suggest there, basing
the ownership on RT6_LOOKUP_F_DST_NOREF.

> 3. In patch 3, stamping a dst entry with 0 due to a mismatch in the
> per-netns counter is too coarse. Any FIB change in the netns (e.g., a
> route inserted into a different table) causes the lookup to replace a
> valid per-CPU dst entry whose route did not change.
>
> We can sample the per-netns counter before the lookup and use it to
> stamp new dst entries. A dst entry is then valid as long as its serial
> number is equal or newer than the node's serial number, and the per-CPU
> dst entry is only replaced when it is no longer valid. This also avoids
> the second read of the counter.
>

Agreed. I considered stamping with the generation sampled before the
lookup in the RFC [3], but validated by equality to avoid a wrap-aware
comparison. The ordered comparison is simpler.

[3] https://lore.kernel.org/netdev/20260901122501.482920-1-ralf@mandelbit.com/

Thanks!

-- 
Ralf Lici
Mandelbit Srl
Technical Details
Message-ID: <20261203165528.848776-1-ralf@mandelbit.com>
Path: mbox-mo1.pugleaf.net!news-ams.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376769-linux-kernel-netdev=dewy.ru
References: <20261201174021.7211-1-dsahern@kernel.org> <20261203153447.GA3201592@shredder>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-ams.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376769-linux-kernel-netdev=dewy.ru
From: ralf@mandelbit.com (Ralf Lici)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v3 00/13] ipv6: validate cached dsts against the netns route generation
Date: Thu,  3 Dec 2026 17:55:28 +0100
Organization: Usenet Network
Message-ID: <20261203165528.848776-1-ralf@mandelbit.com>
References: <20261201174021.7211-1-dsahern@kernel.org> <20261203153447.GA3201592@shredder>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2547032"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:VSJ+gosENwqGy+QwRQ32TmpIGKY= sha256:4Ins7EyFw93qMbh8n7bDZi01Izy0mtcfzYP08GLwYFk=
	sha1:3pb+H0FBdzs3g18dYFLC0oz05uI= sha256:Zyo5kwG6PQ0mQBj5wL79+lEx22BpUnBd+VSi0VhZLkI=
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 84A2E1179E0; Thu,  3 Dec 2026 19:56:31 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.299
X-Spam-Status: No, score=-3.299 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.001,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-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 KvcfchQQLr5A;
	Thu,  3 Dec 2026 19:56:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376769-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 5906C1179DE; Thu,  3 Dec 2026 19:56:18 +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 435582B4DB; Thu,  3 Dec 2026 16:55:43 +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=1796316943;
	b=EJpIH6skrAQCi7uRIFhfe3ibcVWLlrAvswc2Z6fZE5aiOjKgG884g3wQBehfdYjvzTJf
	 F7lLUilyQJJmpDz658Zht+O5WFKO/UfvC6CKSXFq3YuFVPdeEiIthA6I/Evdep7EFW8UR
	 2+5OD7N71LHPRmq5acok2iYfqOcpjU+fA9Izr82x4/r7ZxocF9UAACxvfBvtkWIpRSrkK
	 O/TTcRlwhxaA2Koioi999QNDY7snUZfnZ5fgS5/qC+WP7t8ealjVyRB3dQDfzUp2xXd5S
	 kPKaMx3yAaU7pBPV757jBEycJjvwtZyo7akvTp44Q6vOf0EqhOkCIGorjHNj/3vpANQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796316943;
	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=ej34cbr8tOrEnhqQGeE6WcxCxpWat2FcFjmtTxNMl+s=;
	b=hYaqLG+zCikVB6m0YUT0Y+9jkuuxqyu0A0aaHqTkyVMWfpfPOAs7/IkUomm/+bZdMRe/
	 2HUUOp0gtv4aYgBjcioJ88bPpgxWswlo8/kW27clKd/guV2P+R7iuUHp1O7Wcu3aa1iZm
	 /vHMdbD+fjGDlPpksPcsGmIs5dwmXMg+Vglppz4zVN7b2qOCMPoZ/YUDwT1iWcf1ceZwc
	 JegjNZf4l5m/O0uhNIinx4+flM91q+Zt2c7ZyrGDAGbC/Y2KMTwoQ2DfPbk7S0EU3V+2W
	 UgPZwnGJN0FhAMtTHEb24NpZbQlVzkc7o5AiMKjKMUbYG/nQcZ30m0bvCHCDXWZucCg==
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=igo75IqH;
	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 130EC606A333;
	Thu,  3 Dec 2026 16:55:43 +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=igo75IqH
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.50
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796316942;
	b=zefajpVVW8/LWW8iFGvwGH6DIXndxqoJYRKF2xapK6PsJovdHHRE//TJHBZrWq3BXwc1
	 +FLwSwCUSguek+f4vXxAuN0ag9lwne8b/HrRkWU41cpYFgthGy6S94Kb4WUITQTMfhmYO
	 D8C4t9/uFF9BGi/GO86pd9p8gYWUupIn3ypUKmhTubxL+0nqo8eE65s7go/sE/wPgsUot
	 7xH1P9qPyNZy21P86MQVL/xMhCamPmqWSbemWlT7LHYfTXA4ujFC7o/Fsv2pLZiNLn1DR
	 +ZKfapfqUsJx73JL2G/BDEEHuvBhFv0IigMsu066l+4OFKuITCQdKton5r4tzw/5fuQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796316942;
	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=ej34cbr8tOrEnhqQGeE6WcxCxpWat2FcFjmtTxNMl+s=;
	b=YJPE6EVz1idBkMrPXxiBbpfVDBm43dH0LYfVoXYPy6cBuF8xB9qQUl+ESFBzkzF7vD6u
	 vvwcpprIc7eKcP+GcWWqA8u8L4GLQ4E/Q8N0J+CuyQ141yw0MxJIyxlMGAYwvt2/dAJYO
	 O5WEhyTR9PK32BNaDm99IvJPyejtzdq+W5fRMrLY1qG+flTveO0/AMyHwLzjoAyCB7tsK
	 Q0YnpdZuBe+nBO3PHcme1cSgQ3zW3HwREGKdpKPhjt4lAQGsc1sVGZGwdMEKtj627A8kZ
	 Uc7w1hyev79ZenJoTeiAJlp+qtarvelISaLEYOruY+uo09DwiEzxIEwmq3mV6Ab/DYg==
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=igo75IqH;
	arc=none smtp.remote-ip=195.10.208.50
X-Received: from mout-b-105.mailbox.org (mout-b-105.mailbox.org [195.10.208.50])
	(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 8B50B606A322
	for <netdev@vger.kernel.org>; Thu,  3 Dec 2026 16:55:40 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8B50B606A322
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-105.mailbox.org (Postfix) with ESMTPS id 4jgLNS1PCXz9tmd;
	Thu, 03 Dec 2026 17:55:36 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
	s=MBO0001; t=1796316936;
	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=ej34cbr8tOrEnhqQGeE6WcxCxpWat2FcFjmtTxNMl+s=;
	b=igo75IqHgvIRzNZnklweDVTyhVWGoOGPJHQKjKxarQSOglyK/haNdiJ0eJ6r3LvmaR1+1W
	+rwTBGw0hyYg8CJ5Bga95xGbXVWFzzgVc9ItMhq3t2JW8wGfuX3xfM4V4fKWL8TPePkPsx
	oS7H9iY0MmphCXfteRf1kK9bvS0z5QChpvfOanS0eH+aBaGMuMaqe+Om46mryLCbTOnx4h
	LX+9eXZArUIg21NKDlnhKvfsgYMh7HmcCCZ7vcjN8FeYnYuGAOjQUpvRkjWyS3cjdaLT62
	oCqnufpyNzb5nKIqSDQIOmk1qCxxDE1DPvufcrd4ovrl2h3xo/IyWX5B4xC5fA==
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>,
	netdev@vger.kernel.org,
	davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	horms@kernel.org,
	ja@ssi.bg
X-Mailer: git-send-email 2.56.1
X-In-Reply-To: <20261203153447.GA3201592@shredder>
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: 4jgLNS1PCXz9tmd