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=1796498455; b=jvLIcYw4Gg/ahOB/sZJBVpQBMwtZnGFi45kD281wrxvWzfSUIF1KDYDXM0sUsZhjBymj 37qzdviXBOT87os2hL4QmSftLYzcaB3opl/2Ro6ssjlXo4wxMPE0+e783c8U3uz6yq+Fm 6nELmlhw25orDB8AHd+m0yoVvMC7aRFbVHXOa40+Z5tRNYYOw8QqUhx3lH32U0lZ3ce/A tna8bfbx5EKyCrTT7mAjQJAZG3W98pzauTSrZqLMUxwOjJTwkamVSw9T8u2W7VMPXirkl QaunwKssARIIi7gFCrMOBzbpMCtKzkj5ifSA6UETFrYoi9pz31/+NFgfntbGOqjoBVw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796498455; 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=r15Bo7oT0QbSlClvhiYV2Lg3QODSH3MAoDLsFJqfzsY=; b=THiTzkSglnws3JkZCFEAfepix9gPAxt9N86B8EjSIXYLBCPpV3zUj90+o/IZybcvo9Ja VarTSuB3UnZKZ3ZM2+kv5FouC+rwUxgNFQbGFhKDdrxtmCvzQvZcVnTAarosyDzh7SD6v JB69QCtJ0wnohDivqGMMOkWNdIROVdZJk87QOygCz4RfPMSYPs7XS2AvHUS9eiqOVKp/K DcLFK6lLj1I7przxfvKxfmbEme1gXV2+e6SRkEZvUFwvPHX/cTz2/r/lsB5+ZY80WciVZ wcwmMv6JMNoME47h5Qbo9U1f2mJHTqrwLN54zKR/eHhK0kMltDwIH9apj08eu5z+1yg== 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=Zhv3yZfC; 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 1B4D0606A335 for ; Sat, 5 Dec 2026 19:20:55 +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=Zhv3yZfC Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4375A1F00A10; Sat, 5 Dec 2026 19:20:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796498455; bh=r15Bo7oT0QbSlClvhiYV2Lg3QODSH3MAoDLsFJqfzsY=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Zhv3yZfC/TDqkxvDwaO+j/8Fjp/MYdM6K4s2b79Zi7ehj2sKhQ3C+TdlXd9ZuoEqm a1dQlVmL8AZxZ3jAKxPgFcXYIDJ/k2Y/Lhcda50KQlbYG7Jvaju4WcQAeGHNWmLrjq R4sMIOwicQUJjQe8Azn5ru0xYtyoB1gbOBO+ojx+QLT7oEOaH4KGrUdFXE2VfmNiZ+ zex2JAKTyyVpzQmXdImysqij/Fb1i4SSKY2Rm2fudIu4FlRflWJ1edQQ+xyvKzYigc QVNHK6kWqwfr+4J/2Jf4cQzsr81yaEkv8ip2CQ9dx+iMUmT4FpQrgYAINgYR97c8y0 XSD5yQW4TWoGw== Subject: Re: [PATCH net-next v3 04/13] ipv6: invalidate the failing dst in ip6_link_failure() 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:53 +0000 Message-ID: <179649845377.3148.17926604674199917416@kernel.org> In-Reply-To: <20261201174021.7211-5-dsahern@kernel.org> References: <20261201174021.7211-5-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] ip6_link_failure() in net/ipv6/route.c now invalidates only the dst attached to the failing skb, through rt6_dst_invalidate(rt). - [Low] Verified, then discarded under the series rule (baseline decision: false). -- ipv6: invalidate the failing dst in ip6_link_failure() This patch changes ip6_link_failure() so it no longer writes -1 to the fn_sernum of the default route's fib6_node. It marks only the failing dst as stale, by setting the top bit of its sernum. Readers of rt->sernum now use READ_ONCE(), because the value can change on a published dst. > diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h > index 232289b439c3c..bfc1895e85915 100644 > --- a/include/net/ip6_fib.h > +++ b/include/net/ip6_fib.h [ ... ] > @@ -315,6 +320,24 @@ static inline u32 rt6_get_cookie(const struct rt6_info *rt) > return cookie; > } > > +/* An invalidated dst keeps the generation it was built under in the low > + * bits, so state derived from it (exceptions) can be stamped with the FIB > + * state it actually came from. The top bit makes it fail rt6_is_valid(): > + * the netns generation is always positive. > + */ > +#define RT6_SERNUM_STALE INT_MIN [Severity: Low] This isn't a bug, but does this comment match the code at this point in the series? At this commit, ip6_rt_pcpu_alloc() is the only place that writes a non-zero sernum: if (f6i->nh) pcpu_rt->sernum = rt_genid_ipv6(dev_net(dev)); Legacy dsts (no nexthop object) still have sernum == 0 when ip6_link_failure() marks them. So there is no generation in the low bits to keep. Nothing in this commit reads the low bits or stamps exceptions from them either. Marking a legacy pcpu dst also makes its sernum non-zero for the first time, so the dst now takes the drop path in rt6_get_pcpu_route(): if (pcpu_rt && READ_ONCE(pcpu_rt->sernum) && !rt6_is_valid(pcpu_rt)) { Later patches in the series fix this: "ipv6: validate dsts against the netns route generation" and "ipv6: stamp dsts with the generation sampled before the FIB lookup". They make ip6_dst_alloc() stamp every dst, add rt6_dst_sernum() and stamp exceptions from it, so the comment is accurate at the end of the series. Could the comment and commit message be reworded here, or this patch be moved after those, so that each commit describes what it actually does? [ ... ] > diff --git a/net/ipv6/route.c b/net/ipv6/route.c > index 06afb9d5dc2b1..5af0f26332ffa 100644 > --- a/net/ipv6/route.c > +++ b/net/ipv6/route.c [ ... ] > @@ -2912,14 +2912,14 @@ static void ip6_link_failure(struct sk_buff *skb) > rt6_remove_exception_rt(rt); > } else { > struct fib6_info *from; > - struct fib6_node *fn; > > + /* Force sockets using this dst to look the route up > + * again; a stale-marked sernum never matches the > + * netns generation. > + */ > from = rcu_dereference(rt->from); > - if (from) { > - fn = rcu_dereference(from->fib6_node); > - if (fn && (rt->rt6i_flags & RTF_DEFAULT)) > - WRITE_ONCE(fn->fn_sernum, -1); > - } > + if (from && (rt->rt6i_flags & RTF_DEFAULT)) > + rt6_dst_invalidate(rt); [Severity: Medium] Does this leave the pcpu copies of the same failing default route on other CPUs valid? Before this patch, writing -1 to fn_sernum made every dst under the ::/0 node fail the cookie check: ip6_dst_check() rt6_dst_from_check() fib6_check(from, cookie) Sockets on any CPU then looked the route up again. rt6_check_neigh() returned RT6_NUD_FAIL_PROBE for the NUD_FAILED gateway, and router selection moved those sockets to another default router. Now only the skb's dst is marked. Take a connected socket on CPU1 that holds CPU1's pcpu copy of the same RA-learned (legacy fib6_nh) default route. Its sernum is still 0 and fn_sernum is no longer touched. So in ip6_dst_check() this branch is skipped: if (READ_ONCE(rt->sernum)) return rt6_is_valid(rt) ? dst : NULL; The fn_sernum/cookie check still passes, and the socket keeps sending to the dead router. Each of those packets goes through __neigh_event_send(). That moves the neighbour from NUD_FAILED back to NUD_INCOMPLETE, queues the skb for a full probe cycle and then drops it. Only after that does the path error_report -> ip6_link_failure() mark CPU1's copy. Flows whose skbs were dropped because the neighbour queue was over its length limit never reach ip6_link_failure() at all. Is this intended? The commit message says invalidating the node is "far more than needed" and that the new scope is "one CPU's copy". It doesn't mention that flows through the same failing router on other CPUs now fail over later, each after its own probe timeout and packet loss. This is unchanged at the end of the series. The exception-insert code added later in the series walks nh->rt6i_pcpu_dirty / rt6i_pcpu and calls rt6_dst_invalidate() on each copy. Could ip6_link_failure() do the same for the failing fib6_nh? That would leave other routers' dsts alone but invalidate every copy of this router's dst. > } > rcu_read_unlock(); > } -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201174021.7211-1-dsahern%40kernel.org