🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24768

Re: [PATCH net-next v2 06/13] ipv6: validate dsts against the netns route generation

#24768
From: David Ahern
Date: Mon, 30 Nov 2026 19:31
36 lines
9693 bytes
On 11/27/26 4:03 AM, Ralf Lici wrote:
> On Wed, 25 Nov 2026 18:33:32 -0700, David Ahern <dsahern@kernel.org> wrote:
>> @@ -1476,7 +1483,11 @@ static struct rt6_info *rt6_get_pcpu_route(const struct fib6_result *res)
>>  
>>  	pcpu_rt = this_cpu_read(*res->nh->rt6i_pcpu);
>>  
>> -	if (pcpu_rt && READ_ONCE(pcpu_rt->sernum) && !rt6_is_valid(pcpu_rt)) {
>> +	/* A dst stamped with an older genid stays stale for everyone still
>> +	 * holding it, as in IPv4. Never re-stamp it; drop it and build a
>> +	 * new one.
>> +	 */
>> +	if (pcpu_rt && !rt6_is_valid(pcpu_rt)) {
>>  		struct rt6_info *prev, **p;
> 
> This now evicts the pcpu dst of every route after any generation change,
> and the eviction still drops the slot's reference right away
> (rt6_uncached_list_add and dst_release from 02/13). A reader that took
> the dst from the slot without a reference can then see it freed, when
> the only other reference is the child reference of an xfrm bundle:
> 
> 1. Bundle X, whose child is the pcpu dst P of CPU0, drops its last
>    reference, and dst_release queues dst_destroy_rcu.
> 2. After that grace period has started, a lookup with
>    RT6_LOOKUP_F_DST_NOREF on CPU0 gets P from the slot inside its RCU
>    section, and is preempted (PREEMPT_RCU) before dst_hold_safe.
> 3. A lookup on CPU0 after a generation change evicts P and drops the
>    slot's reference, so X's child reference is the last one.
> 4. X's grace period ends without waiting for the first lookup, and
>    dst_destroy(X) frees P with dst_release_immediate.
> 
> Mainline only evicts nexthop-object dsts this way, and
> fib6_nh_release_dsts has the same pattern, as Sashiko pointed out on my

I do not recall that being intentional. If anything we want consistency
across built-in nexthops and separate nexthop objects.
Technical Details
Message-ID: <88b0bd75-fb61-4469-a98f-6e30b3a63824@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374420-linux-kernel-netdev=dewy.ru
References: <cover.1795642432.git.dahern@nvidia.com> <52846eb18319fc2841ffa6dbb32abcc898eca8df.1795642432.git.dahern@nvidia.com> <20261127110319.354669-1-ralf@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374420-linux-kernel-netdev=dewy.ru
From: dsahern@kernel.org (David Ahern)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 06/13] ipv6: validate dsts against the netns
 route generation
Date: Mon, 30 Nov 2026 12:31:58 -0700
Organization: Usenet Network
Message-ID: <88b0bd75-fb61-4469-a98f-6e30b3a63824@kernel.org>
References: <cover.1795642432.git.dahern@nvidia.com>
 <52846eb18319fc2841ffa6dbb32abcc898eca8df.1795642432.git.dahern@nvidia.com>
 <20261127110319.354669-1-ralf@mandelbit.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="1518741"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:I9KIS2z87aB7w1MkbI706IdXeZg= sha256:RgP3NKr14FIqMxR622rgUsNCSAJ+A+KA5wRn3TtSw5k=
	sha1:PtaG14PYykc2rJiLVe+Vqvwwyb4= sha256:tNasQZ6Zi3rGhArzSH7TCqutcA7OPQAQ96pdQ/K/nHE=
Content-Language: en-US
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 C4983125FFC; Mon, 30 Nov 2026 22:32:17 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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=kernel.org
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 vFuguSl3oTMS;
	Mon, 30 Nov 2026 22:32:14 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-374420-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id A2FCD126000; Mon, 30 Nov 2026 22:32:03 +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 2A304601A03; Mon, 30 Nov 2026 19:32:03 +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=1796067120;
	b=cvYAilvkPkbLNei4gGVZ4kbsplQLJMqKYqzHNubRArUJFDeNsBvXx7xWGyT1VWXh7SWX
	 HH1TytR9bUXFgrWUIyaK2Vnu6aZH1VnpOjU7avgTT1pg73OCZRRGN8l9VmQrLbb0gSvVr
	 Pu7MY3VDF07JhVd4sS7R8WmCOrKqIE2RHNsyC9CGntOvh7SJfEOrxNaz5Ps/HWowJo2Nh
	 mVtlffkOCxoMsqzbMU7UTUCKjThkBG2+dV5vXBY5xBHzIOSmiq8lzH/5Pp2Sfr18Cz4dW
	 Nnpk3DoScfUbythI1pLTKs0cP88yMifSpWV/i7DKO8vIp3yXagiMdv8ipvvURrpcQqA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796067120;
	h=X-Original-To:Received:Received:DKIM-Signature:Message-ID:Date:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent:
	 Subject:Content-Language:To:Cc:References:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding;
	bh=xv2lYisJPLM/1Vak4EnaWAfeZG8maeMRa4X3CzEa0Yo=;
	b=lzpwY6A0sPKzO9RpH36ytcekfRvs3EukagUcU+U5+4TSTdSh8FPeEqQvGPCTPGYW6CPU
	 WE1cDAmV8vKB7tcs7bsF0dAxs6uAfSLQCYb1xV4kIb9oJgqIdayiKKNIZu4G4rXdDt3vv
	 J+l6SMHwWvYRnUz6vpmm4IsvJRNc1zgaNue9ohXnGbecJhb3PvUm3rngaz2nbgkhxZqIb
	 q5kh93xBJGCCn8viq6qQe+zdFb5Q2DfMT3TFwHOhygfUEs5o8ncDlXS7W91jlPChljMJf
	 lDNH8ndyGOF2uBfaMqYrUT46g7Ippb55OnnaRXvd9FEKwNNrSgRWxcl21WqGH3lpXeg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bq9F08TA;
	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 C9656606A32D;
	Mon, 30 Nov 2026 19:32:00 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bq9F08TA
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796067120;
	b=FYVVUlNdFgy7sCxeDlbI79upzcy4X+cYVBmqs2+rv7PcvyY8Sxwb8rDAWs8va+2sEWzK
	 KpeG1bVQHxYn22aNfkJp4MMi+pfguchBDZmnBwUqi+YP2Tyxg8ZaLwNCoZRGUFXpHk/kL
	 h5hC/iZVcBX/nQ9PsGui063PbRJsaVN2tjvr5iRnS8iRejNTBb+XPvwW+uiL2G4qe8bDs
	 JfYFCRFQLDwDHCJGz7dMGVum9tGEAT/IvOeMl2eR2H/c1ncta3Qy+CAGDNftHnJMLBa1R
	 q0Aqp/VmJkaFl/oVvtV2L2jV8yhOywwFDDLaCJCPVWGm1ArB4KUuPtlj75SIBaPwG5w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796067120;
	h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent:
	 Subject:Content-Language:To:Cc:References:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding;
	bh=xv2lYisJPLM/1Vak4EnaWAfeZG8maeMRa4X3CzEa0Yo=;
	b=C0P1juDDHNDmgVQrOkFG7sD8eYEUb5axCpBrgcUEuF2rGQQgfexvZQFeptA03TyHll9a
	 E0AlqjJv1fB+8SGa+EjVhKtN0loLh2VumY2rPPx2fW1EE2bRLkVkNkdWoKF3zV71O8VGV
	 OYOTqo/nC1cB63YnxsYEm27wPWUNITcdmKiHrtAX5T83fMasDDK/jGgZvHe8zaojSsHTT
	 bMJ0cyO6wCR78k7DscGoirLjKKYO4jjqeCfwJoaAuG8lxu+MNmsAX8OAfM8F5CYoT6Vn2
	 hcgDnolLOcgszfo2OAz54HiL1PuRdUhR4EJLE990wWs5P0Ux3gYNeP6f1hTbxP7OCPQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bq9F08TA;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id E51A8606A320
	for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 19:31:59 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11FCF1F000C1;
	Mon, 30 Nov 2026 19:31:59 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796067119;
	bh=xv2lYisJPLM/1Vak4EnaWAfeZG8maeMRa4X3CzEa0Yo=;
	h=Date:Subject:To:Cc:References:From:In-Reply-To;
	b=bq9F08TAZJleYIDUm9yWUMy13ryqwP/yb9kXUQJ+7gQzPPDvPF+m27NGwO1bOLEZp
	 veo+idljbGTN9pReOXz0+G3VvwXtgPHWrOxnhel7qeKe8I6YCOtXIvf0g/Jc1gNRLe
	 KlsIyOyaT69CIYxHQMKoE5ykHrcPfDC+PElGzdZCdJOQ9GuZ+vGfv/o9/hY4L1sYU4
	 6I87dnXhZxmlumICvDDG+S2pQ+YpKK3nUACXtlEvwiSKSxTaRkuDY7YM99hrbngY8o
	 Gx1hSopHXNCUDQFyt3JbvhtW6SbOIO+u1nqj0w3Jdxw+AuWXs9U4GbxC0g1eW+oyKH
	 k53cUKnADb8Fg==
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-User-Agent: Mozilla Thunderbird
X-Cc: netdev@vger.kernel.org, idosch@nvidia.com, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
 ja@ssi.bg, David Ahern <dahern@nvidia.com>
X-In-Reply-To: <20261127110319.354669-1-ralf@mandelbit.com>