From: Ralf Lici <ralf@mandelbit.com>
To: David Ahern <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, ja@ssi.bg, David Ahern <dahern@nvidia.com>
Subject: Re: [PATCH net-next v2 06/13] ipv6: validate dsts against the netns route generation
Date: Fri, 27 Nov 2026 12:03:19 +0100 [thread overview]
Message-ID: <20261127110319.354669-1-ralf@mandelbit.com> (raw)
In-Reply-To: <52846eb18319fc2841ffa6dbb32abcc898eca8df.1795642432.git.dahern@nvidia.com>
On Wed, 25 Nov 2026 18:33:32 -0700, David Ahern <dsahern@kernel.org> 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
v5:
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1795537128.git.ralf%40mandelbit.com
--
Ralf Lici
Mandelbit Srl
next prev parent reply other threads:[~2026-11-27 11:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 1:33 [PATCH net-next v2 00/13] ipv6: validate cached dsts against the netns route generation David Ahern
2026-11-26 1:33 ` [PATCH net-next v2 01/13] ipv6: allocate the exception entry before removing the one it replaces David Ahern
2026-11-26 1:33 ` [PATCH net-next v2 02/13] ipv6: keep a superseded pcpu dst working until its holders notice David Ahern
2026-11-26 1:33 ` [PATCH net-next v2 03/13] ipv6: don't insert a PMTU exception whose MTU could not be stored David Ahern
2026-11-26 1:33 ` [PATCH net-next v2 04/13] ipv6: invalidate the failing dst in ip6_link_failure() David Ahern
2026-11-26 1:33 ` [PATCH net-next v2 05/13] ipv6: tell route dumps about exception inserts with a table sequence David Ahern
2026-11-26 1:33 ` [PATCH net-next v2 06/13] ipv6: validate dsts against the netns route generation David Ahern
2026-11-27 11:03 ` Ralf Lici [this message]
2026-11-26 1:33 ` [PATCH net-next v2 07/13] ipv6: make rt_genid_bump_ipv6() a plain counter increment David Ahern
2026-11-26 1:33 ` [PATCH net-next v2 08/13] nexthop: factor out nh_has_f6i() David Ahern
2026-11-26 1:33 ` [PATCH net-next v2 09/13] nexthop: bump the IPv6 route generation on group changes David Ahern
2026-11-26 1:33 ` [PATCH net-next v2 10/13] ipv6: stamp dsts with the generation sampled before the FIB lookup David Ahern
2026-11-26 1:33 ` [PATCH net-next v2 11/13] selftests: net: pmtu: check that a deleted cached exception stays deleted David Ahern
2026-11-26 1:33 ` [PATCH net-next v2 12/13] selftests: net: fib_tests: Add stale pcpu test David Ahern
2026-11-27 10:47 ` [PATCH net-next v2 00/13] ipv6: validate cached dsts against the netns route generation Ralf Lici
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261127110319.354669-1-ralf@mandelbit.com \
--to=ralf@mandelbit.com \
--cc=dahern@nvidia.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=ja@ssi.bg \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox