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=1796473863; b=NCfp0toolgasVIw3jiCr5/hMoznbA+w87jjA9tLljeUB71iAYhUySdR/kA33VTDupOff 9YnLGsjp/0LdGY3o98OnovCqbDMV2Rt1CLOsKfNxgt2pSncKCvyHrfTb6WX+BfsbFBsRS JYavmj0oIGlv3E4r6Mr+ilqCCOgWedsXh0/m3BgZWCHM8/U7rXsmjb+8X9pcVdbUTsNbz nCStF4wasR66/CzH3hhmyBs0uBmw7yBXZzSniPeCKWuCRKYXauohjW957WHH6hRM9nCXe iEccpwEwcfawQmONFP0us1vRPvuq/akyKiROVIkrcmHfe26yoIR3pmsJOrM8HpBCyeQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796473863; 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=uGkaye+bQDv3ziH5RqrxHmxM0FFezopKNJ6DpHcqq+g=; b=K2hszCe5ybptl2BUxGxGGUFT+w8Jf8VGZW5Uo1sfFqsSdHCnIryeMMuUg7fb6SvTkxl1 byaG3yG3r812XyUKmV3rxZCKTVijM3OzV+ajv3v4Fawlqu1by7FbcIP5ev7u2S3/rKcNd Gb4uP6+VGw7HuF6P3sMCepnkqSP4EbACwBmmhlOowxQFGQqWoiZGEe2KiivgoEeNJKlrx kqoT9nmpH0Lye/O2FP2MUXkPU4EI7BKlaoXWGIcwFC0pJmHOJANd2+e9a+IT3vi1Wmk/t ruSe9HV2yHaauzeiLscV63YiVuUcBvT+gFh8D38NV9rEBvz22lixg39ZkVg7eWnSQ1g== 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=hLUryvkF; 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 B21E3606A334; Sat, 5 Dec 2026 12:31:03 +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=hLUryvkF Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D3ED1F0092B; Sat, 5 Dec 2026 12:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796473863; bh=uGkaye+bQDv3ziH5RqrxHmxM0FFezopKNJ6DpHcqq+g=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=hLUryvkF8AUcje2+opkohhTHXrF5VDW5fwEbwWv2igVC5LRaPhdXXOw4REymOtH2z zU5sAzxGaN/UdXv/fSa1qHw9fOtYQZfo0373k8karpNh9DbRmXezuSP+pnOdIufTJj tf6yEp6ra9NwW+1m1s03cpUkvHTM1K+kuhDaL8yJ+YteZt/aodbLMTGulvizARHag0 rRvTPoguuHRTwu7dE5gFZK02aWMnJfNbth03buEupr4O/rGv6hYCfKSC6po1rsWqWQ PF/QArBKqLlrtLC/O9lniIq2Xf2tt0WT/S73dEzHn6Yrn4l8lViHKx0TwE7doPTQUn 9Vky41CpAYnnw== Subject: Re: [PATCH net-next 2/2] ipv6: keep a superseded pcpu dst working until its holders notice From: netdev-bot+sashiko@kernel.org To: ralf@mandelbit.com Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, linux-kernel@vger.kernel.org, dahern@nvidia.com, andrea.mayer@uniroma2.it, antonio@mandelbit.com Date: Sat, 05 Dec 2026 12:31:02 +0000 Message-ID: <179647386221.3146.9662783054271208111@kernel.org> In-Reply-To: References: X-sashiko-severity: High 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: 1 · Medium: 1 · Low: 0 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). - [High] The fix is incomplete. - [Medium] The patch puts a stale nexthop pcpu rt6_info (rt->sernum != 0) on the uncached list. -- ipv6: keep a superseded pcpu dst working until its holders notice This changes rt6_get_pcpu_route() so that an invalidated pcpu dst of a nexthop-object route is put on the uncached list instead of being dst_dev_put() when it is taken out of its per-CPU slot. The slot's reference is now dropped after an RCU grace period, so that RT6_LOOKUP_F_DST_NOREF readers are not left with a freed dst. Link: https://lore.kernel.org/netdev/20261201174021.7211-3-dsahern@kernel.org/ > diff --git a/net/ipv6/route.c b/net/ipv6/route.c > index 39bcfa1ce01b1..df4d670bcfa60 100644 > --- a/net/ipv6/route.c > +++ b/net/ipv6/route.c > @@ -1499,8 +1499,8 @@ static struct rt6_info *rt6_get_pcpu_route(const struct fib6_result *res) > /* Paired with READ_ONCE() in __fib6_drop_pcpu_from() */ > prev = xchg(p, NULL); > if (prev) { > - dst_dev_put(&prev->dst); > - dst_release(&prev->dst); > + rt6_uncached_list_add(prev); > + rt6_dst_release_deferred(prev); [Severity: High] The commit message describes two problems with a superseded nexthop pcpu dst: 1. dst_dev_put() turns a dst that is still held into a discard. 2. The slot reference is dropped without a grace period while RT6_LOOKUP_F_DST_NOREF readers may still be using the dst. Is the same pattern still there in fib6_nh_release_dsts()? net/ipv6/route.c:fib6_nh_release_dsts() { ... for_each_possible_cpu(cpu) { ... pcpu_rt = xchg(ppcpu_rt, NULL); if (pcpu_rt) { dst_dev_put(&pcpu_rt->dst); dst_release(&pcpu_rt->dst); } } } On a group replace, this runs synchronously under RTNL for every IPv6 member of the replaced group: replace_nexthop() nh_rt_cache_flush(net, old, new) fib6_nh_release_dsts(&nhi->fib6_nh) The member nexthops stay live, so readers on other CPUs can still get to their pcpu slots. Suppose the dst's references are the slot plus the child reference of an xfrm bundle B, and B's call_rcu() is already pending. Can this sequence free the dst under a NOREF reader? CPU1 CPU0 rcu_read_lock() ip6_route_input() takes the pcpu dst NOREF from its slot fib6_nh_release_dsts() xchg(ppcpu_rt, NULL) dst_release() /* 2 -> 1 */ B's grace period ends; it does not cover CPU1's read section dst_destroy(B) dst_release_immediate(child) /* 1 -> 0, freed */ uses the dst On a single nexthop replace, replace_nexthop_single() swaps nh_info. Then nexthop_put(new) reaches this path from an RCU callback: nexthop_free_single() fib6_nh_release() fib6_nh_release_dsts() The grace period problem doesn't apply there. But wouldn't dsts still held by sockets, a tunnel dst_cache, xfrm bundles or queued skbs be blackholed, just as the commit message describes for rt6_get_pcpu_route()? A nexthop replace looks like the most direct way for a nexthop pcpu dst to be superseded. Should fib6_nh_release_dsts() also use the uncached list and the deferred release? [Severity: Medium] Before this change, dst_dev_put() set dst.obsolete to DST_OBSOLETE_DEAD. Now a pcpu dst with rt->sernum set goes on the uncached list, and its obsolete stays DST_OBSOLETE_FORCE_CHK. When the device later goes down or is unregistered, rt6_uncached_list_flush_dev() does this: rcu_assign_pointer(rt->dst.dev_rcu, blackhole_netdev); ... from = unrcu_pointer(xchg(&rt->from, NULL)); fib6_info_release(from); It does not change obsolete or sernum. ip6_dst_check() then returns early for dsts that have a sernum: if (rt->sernum) return rt6_is_valid(rt) ? dst : NULL; So the rt->from check, which rejects other flushed uncached dsts, is never reached. rt6_is_valid() compares rt->sernum against rt_genid_ipv6(dev_net(rt->dst.dev)). After the flush that is init_net, because blackhole_netdev lives there. For a route in a non-init netns, ip6_rt_pcpu_alloc() took rt->sernum from the original netns. Every netns counter starts at 1 and goes up by one per FIB change. Can the stale sernum equal init_net's current fib6_sernum? If so, would ip6_dst_check() accept the blackholed dst? The socket, tunnel dst_cache or xfrm bundle holding it would then keep sending into blackhole_netdev until init_net's fib6_sernum changes. The commit message says rt6_uncached_list_flush_dev() detaches the dst "like any other uncached dst", but other uncached dsts have a zero sernum. Does the flush path, or the move to the uncached list, need to clear rt->sernum or mark the dst DST_OBSOLETE_DEAD? > } > > pcpu_rt = NULL; -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1796382820.git.ralf%40mandelbit.com