🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27482

Re: [PATCH net-next v3 09/13] nexthop: bump the IPv6 route generation on group changes

#27482
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 19:20
141 lines
13224 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] remove_nexthop_from_groups() in net/ipv4/nexthop.c decides
  whether to bump the IPv6 generation too early.
- [Low] The commit fixes two user-visible bugs: stale IPv6 dsts after
  replacing a member used only through a group, and after removing a…

--

nexthop: bump the IPv6 route generation on group changes

This commit bumps the netns IPv6 route generation in two more cases: when
a group member is replaced and IPv6 routes use it only through a group,
and when a member is removed from a group. The aim is that dsts built
from the old group no longer pass validation.

> diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
> index 53431fe7d3281..7cf496589f4f4 100644
> --- a/net/ipv4/nexthop.c
> +++ b/net/ipv4/nexthop.c

[ ... ]

> @@ -2134,13 +2150,19 @@ remove_nexthop_from_groups(struct net *net, struct nexthop *nh,
>  	if (list_empty(&nh->grp_list))
>  		return false;
>  
> -	list_for_each_entry_safe(nhge, tmp, &nh->grp_list, nh_list)
> +	list_for_each_entry_safe(nhge, tmp, &nh->grp_list, nh_list) {
> +		have_f6i |= nh_has_f6i(nhge->nh_parent);
>  		need_flush |= remove_nh_grp_entry(net, nhge, nlinfo,
>  						  &deferred_free);
> +	}
>  
>  	/* make sure all see the newly published array before releasing rtnl */
>  	synchronize_net();
>  
> +	/* a group lost a member: dsts built from the old group are stale */
> +	if (have_f6i)
> +		rt_genid_bump_ipv6(net);
> +

[Severity: Medium]
Can the bump be skipped if an IPv6 route is added to the group while the
member is being removed?

have_f6i is read from the parent's f6i_list before remove_nh_grp_entry()
publishes the new array with rcu_assign_pointer(nhp->nh_grp, newg). It is
then used after synchronize_net().

IPv6 route insertion does not hold RTNL. RTM_NEWROUTE is registered with
RTNL_FLAG_DOIT_UNLOCKED, and ip6_route_info_create_nh() looks up the
nexthop under rcu_read_lock(). fib6_add_rt2node_nh() then links the route
into the group's f6i_list while holding only the group's nh->lock:

net/ipv6/ip6_fib.c:fib6_add_rt2node_nh() {
    ...
	list_add(&rt->nh_list, &rt->nh->f6i_list);
    ...
}

So with member X being deleted from group G, this sequence looks possible:

CPU0 (holds RTNL, deleting X)
remove_nexthop_from_groups()
    nh_has_f6i(G) returns false, have_f6i stays false

CPU1 (RTM_NEWROUTE with nhid=G)
fib6_add_rt2node_nh()
    route R is linked into G->f6i_list

CPU2
ip6_pol_route()
    finds R, selects a path from the old G->nh_grp, and builds a dst
    stamped with the current generation

CPU0
remove_nh_grp_entry()
    rcu_assign_pointer(nhp->nh_grp, newg);
synchronize_net()
    have_f6i is false, so rt_genid_bump_ipv6() is not called

The later "ipv6: stamp dsts with the generation sampled before the FIB
lookup" change does not help here. No bump follows the publish, so the
sampled generation is still current. rt6_is_valid() keeps passing until
some unrelated FIB change. This looks like the "dsts built from the old
group stayed valid" case that the commit message says it closes.

Two kinds of dst would stay valid:

- pcpu dsts through surviving members, built under the old
  hash-threshold or resilient mapping
- uncached FLOWI_FLAG_KNOWN_NH clones through the deleted member, which
  fib6_nh_release_dsts() does not reach

Pcpu dsts held in the deleted member's own rt6i_pcpu are released with
dst_dev_put() when X is freed, so they are not affected.

Could the decision be made after synchronize_net(), using the surviving
parents (the nh_parent of the entries on deferred_free)? Another option
is to bump every time a group loses a member, since rt_genid_bump_ipv6()
is now a plain counter update.

[ ... ]

> @@ -2264,7 +2286,8 @@ static void nh_rt_cache_flush(struct net *net, struct nexthop *nh,
>  	if (!list_empty(&nh->fi_list))
>  		rt_cache_flush(net);
>  
> -	if (nh_has_f6i(nh))
> +	/* dsts are validated against the netns route generation */
> +	if (nh_used_by_f6i(nh))
>  		rt_genid_bump_ipv6(net);

[Severity: Low]
This isn't a bug, but should this commit carry a Fixes: tag?

Both gaps predate this series. The check in nh_rt_cache_flush() that
looks only at the member's own f6i_list goes back to the original
nh_rt_cache_flush() in commit 7bf4796dd09984 ("nexthops: add support for
replace"). Blame also points at 4787a6d2629b4e. The baseline
remove_nexthop_from_groups() never bumps the IPv6 generation after
republishing a group.

Other fixes in this series have Fixes: tags. Examples are "ipv6: keep a
superseded pcpu dst working until its holders notice" and "ipv6: allocate
the exception entry before removing the one it replaces". Without a tag
here, stable maintainers cannot tell which kernels need this change.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201174021.7211-1-dsahern%40kernel.org
Technical Details
Message-ID: <179649845889.3148.6654332243642584580@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.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-378106-linux-kernel-netdev=dewy.ru
References: <20261201174021.7211-10-dsahern@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.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-378106-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v3 09/13] nexthop: bump the IPv6 route generation
 on group changes
Date: Sat, 05 Dec 2026 19:20:58 +0000
Organization: Usenet Network
Message-ID: <179649845889.3148.6654332243642584580@kernel.org>
References: <20261201174021.7211-10-dsahern@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3103490"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:bVqbBJTDyIUuUBFVRxW1v7uFAZ4= sha256:TShM0K6EzpppKM393jiIHxHKLW27R0m1MkePHfnCuVc=
	sha1:NR5bc+9xRwtqdqg3uEPozmMlXeo= sha256:A0DBQAmdtcE80yk7iG+PHo2FEDsUfCthysMHXGwFDLs=
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 348E8117E92; Sat,  5 Dec 2026 22:21:28 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.539
X-Spam-Status: No, score=-3.539 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, 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, URIBL_BLOCKED=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 MukF4Uxpy6Ot;
	Sat,  5 Dec 2026 22:21:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378106-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 0F08C117E93; Sat,  5 Dec 2026 22:21:17 +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 93DE833C40; Sat,  5 Dec 2026 19:21:01 +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=1796498461;
	b=3+8BNVfWGPhvPjd58CnKNFGe8sqd8IiJG2meK8Ce/M0M/Rkk/WkwWY4RV7tM0kQZpYS8
	 NTmcmZ96leuz4J+ii7ZfvacPr24or9fWXeYI4P0UN5nbbu2oEqeEovVRGpbniTM7kYTRM
	 yiKY1znN4/0J0ddFVT6ipNduS6WaBzFOvjL+ahTpJHRq5wnDG+B4ZqrNs2C1h0QkhHMEU
	 xh7gLGHPGmGJvBvEYsfZigbFtQTKKvcZWNgpnOZ5M8Y9AB+qM91cdEZgAwPWReKGwnpsu
	 kS0g7Bt3lIZlw2Qmh4pv4prtb6YJEk7Fvv3tU6ORBSQQjnmhuPaE5Qyr5Rt1y4lTi6A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796498461;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=otPWeaW2z+NO10bCKJyOaHfXztybdpeYn69OEyK2sSM=;
	b=xD/JLzb3PhIokekLThaYTO3RvT6MV70rE9Atp8bOynVhm+/L3n2wocaKajTFM5cfQ4Di
	 8dPvunqMRZND2MilUsAH0UgBeTP7jOeMgIZI6P3NbvRnaPFOpnnYmiJPsl3K+NU4xq1z3
	 K+HkcJGhYgTN13feBd+ClXEraXQ0k14au9G0WfZ33AmjbLTfUwyZk7hcImrnxdp7XsihC
	 aZjLcqc51UAozJgKShGVF5u79xYcJvRsMrieppV85tOcluwyd8xBPn5Nh9X6qHPdLL/lc
	 qwO+8z1zO6JMHiRSGNGq5GLklKPJ/LdiKwZG9Oiw8X3Ll99KWz+RS/R/86OW6ISHC9w==
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=TxuiTtvZ;
	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 42CB7606A32F;
	Sat,  5 Dec 2026 19:21:01 +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=TxuiTtvZ
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=1796498460;
	b=1WZR8YTo2Jd7eTFwC6lTwmY8463plMR0j5pGtEuqO/0DDvcgez+U3ZO5dGLk11fpFphH
	 qlWd5DkseuRt2SLc534xtlOuyVZ5OtEAAlZFzj8Fk3l7AspPdIwzCHlctselXlANV24DT
	 zVQ1S0+dNAss8Adu5tdcFoPxWTIIyXYZS+gBu7SRpVXiCEZEtL7ppBtCfhc6CzOdF2m5e
	 LIqNraApvhQgP81WUirjmYeFr9y+i+2k0Y7yVPYVrmR1B6cqRWAoypH/6SNBcsEjOnb45
	 m56FmwU+74DNZo3mrDHKlItN+9sztcjFcNlu9rZ8qNL0zm/hUWNXLrqXvyjcUrppVag==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796498460;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=otPWeaW2z+NO10bCKJyOaHfXztybdpeYn69OEyK2sSM=;
	b=Mih7TvMBtppyp01lmVTTpQBYf85kpvXSrnEDTiXOINBefjMFbs1ytMPOV8c259citPI2
	 JfmM/JGxeuRyqDBRFwAXAz0utFeBU64FwLuu8YTKHY+Z4hM5jzGwM0yMfpQr9PwDzoxEV
	 4KRqESNCamVYKLWTPeXHYnQuQ/YDCym9AuPuXEcVnt/CUPpDSTxqOuJ9UDVqKzsoxcdd6
	 Bn6wGFXLUJpu19iQ1AJBbTXti0Lbbt3Sha8l0Z0+7jwYKTXITakfrVmDjce32LXYYF+E5
	 ABWf4n8tx7+53G/WDZ1urmCL6LdZPB6KxQftIQb/tiSXAEG9MuMdf0XTntD1aMPA6IA==
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=TxuiTtvZ;
	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 669C5606A33E
	for <netdev@vger.kernel.org>; Sat,  5 Dec 2026 19:21:00 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 545051F00A14;
	Sat,  5 Dec 2026 19:20:59 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796498460;
	bh=otPWeaW2z+NO10bCKJyOaHfXztybdpeYn69OEyK2sSM=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=TxuiTtvZ0/S+yDPNEQSX5CXZHyUcj1J2deS56ZXCSZCsepAIXTJjB2ZBQm9x0y//O
	 8fYBkIF2LPAu9J6CCm2IqCqP39jqMycsocKu2oCROqk/FhziRxCWScJAF5zCWJoLG6
	 ghrIpQL6U+V3hJsNA2qy20utL/rzNcYl/3QISxAvdPrZs3BwlRcXzj119AKQrXXnxD
	 GYJOmXZfgYf5UVSOqaAtSNdnnsZt0MufENw2Nb30VRmKSWfQrIU48qfvKbOgaXem2A
	 mp3m3i+0e9KmQhO53G5iv4VaEcvTi9cYw7gPbM+rnUf/JAWzKTVErW2TkHlGwAGmiW
	 Is7vMtAxUqocQ==
X-Cc: netdev@vger.kernel.org, idosch@nvidia.com, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
 ralf@mandelbit.com, ja@ssi.bg, dahern@nvidia.com, noreply@anthropic.com
X-In-Reply-To: <20261201174021.7211-10-dsahern@kernel.org>
X-sashiko-severity: Medium
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