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=1796067120; b=FYVVUlNdFgy7sCxeDlbI79upzcy4X+cYVBmqs2+rv7PcvyY8Sxwb8rDAWs8va+2sEWzK KpeG1bVQHxYn22aNfkJp4MMi+pfguchBDZmnBwUqi+YP2Tyxg8ZaLwNCoZRGUFXpHk/kL h5hC/iZVcBX/nQ9PsGui063PbRJsaVN2tjvr5iRnS8iRejNTBb+XPvwW+uiL2G4qe8bDs JfYFCRFQLDwDHCJGz7dMGVum9tGEAT/IvOeMl2eR2H/c1ncta3Qy+CAGDNftHnJMLBa1R q0Aqp/VmJkaFl/oVvtV2L2jV8yhOywwFDDLaCJCPVWGm1ArB4KUuPtlj75SIBaPwG5w== 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== 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 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 ; Mon, 30 Nov 2026 19:31:59 +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=bq9F08TA Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11FCF1F000C1; Mon, 30 Nov 2026 19:31:59 +0000 (UTC) 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== Message-ID: <88b0bd75-fb61-4469-a98f-6e30b3a63824@kernel.org> Date: Mon, 30 Nov 2026 12:31:58 -0700 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 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v2 06/13] ipv6: validate dsts against the netns route generation Content-Language: en-US To: Ralf Lici 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 References: <52846eb18319fc2841ffa6dbb32abcc898eca8df.1795642432.git.dahern@nvidia.com> <20261127110319.354669-1-ralf@mandelbit.com> From: David Ahern In-Reply-To: <20261127110319.354669-1-ralf@mandelbit.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/27/26 4:03 AM, Ralf Lici wrote: > On Wed, 25 Nov 2026 18:33:32 -0700, David Ahern 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.