From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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 ; Sat, 5 Dec 2026 19:21:00 +0000 (UTC) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 545051F00A14; Sat, 5 Dec 2026 19:20:59 +0000 (UTC) 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== Subject: Re: [PATCH net-next v3 09/13] nexthop: bump the IPv6 route generation on group changes From: netdev-bot+sashiko@kernel.org To: dsahern@kernel.org 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 Date: Sat, 05 Dec 2026 19:20:58 +0000 Message-ID: <179649845889.3148.6654332243642584580@kernel.org> In-Reply-To: <20261201174021.7211-10-dsahern@kernel.org> References: <20261201174021.7211-10-dsahern@kernel.org> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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