From: Ralf Lici <ralf@mandelbit.com>
To: David Ahern <dsahern@kernel.org>
Cc: netdev@vger.kernel.org
Subject: Re: [RFC net-next v2 0/7] ipv6: validate dsts against the netns route generation at lookup
Date: Tue, 24 Nov 2026 21:46:21 +0100 [thread overview]
Message-ID: <20261124204623.45969-1-ralf@mandelbit.com> (raw)
In-Reply-To: <72ade685-ecce-4215-a30b-25be7666e299@kernel.org>
On Tue, 24 Nov 2026 10:15:40 -0700, David Ahern <dsahern@kernel.org> wrote:
> IPv6's finer grained invalidation of fib changes is why this whole
> cookie caching mess exists. It is a performance optimization that to me
> has gotten out of hand and as you reported is the cause of functional
> incorrectness with both xfrm and other caching.
>
> I spent the morning doing a deep dive on the claude assisted patches and
> really like the direction. Making ipv6 fib management and invalidation
> align with ipv4 should remove the need for all of the cookie stashing on
> sockets and elsewhere plus remove the cookie argument to the dst APIs
> including sockets. ie., it is a good cleanup and simplification of the
> code base with the cost of more invalidations on ipv6 fib changes.
>
Understood. My goal is to get the race fixed, so if this is the
direction you want to take, I'll drop my series. FTR, I don't think the
finer grained invalidation is the culprit here so much as reading the
cookie after the lookup instead of during it, and I still think the
per-node scope might be worth keeping (v5 shows that it can be kept with
validity in the dst), but the trade-off is yours to make.
Whichever way it goes, a few things I found while working on this apply
to your series as well, some more broadly since any FIB change in the
netns makes every pcpu dst stale:
- A found pcpu or exception dst has to match the lookup's sample,
otherwise a lookup can return a dst rebuilt after the route it
selected changed.
- A replaced pcpu dst released with dst_dev_put discards packets for
holders that use it without validating it again, such as a corked UDP
socket.
- Dropping the slot's reference with dst_release while an xfrm bundle
holds the dst as its child can free it under a lookup that read the
slot without taking a reference, as the bundle drops its own reference
without waiting for a grace period. 4/4 of my v5 defers the slot's
release with call_rcu.
- Stale exceptions need to keep their PMTU and redirect information
instead of being treated as misses.
- The forwarding sysctl is read in ip6_pol_route before the generation
is sampled.
--
Ralf Lici
Mandelbit Srl
prev parent reply other threads:[~2026-11-24 20:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 21:26 [RFC net-next v2 0/7] ipv6: validate dsts against the netns route generation at lookup David Ahern
2026-11-23 21:26 ` [RFC net-next v2 1/7] ipv6: validate dsts against the netns route generation David Ahern
2026-11-23 21:26 ` [RFC net-next v2 2/7] ipv6: invalidate the failing dst in ip6_link_failure() David Ahern
2026-11-23 21:26 ` [RFC net-next v2 3/7] nexthop: factor out nh_has_f6i() David Ahern
2026-11-23 21:26 ` [RFC net-next v2 4/7] nexthop: bump the IPv6 route generation on group changes David Ahern
2026-11-23 21:26 ` [RFC net-next v2 5/7] ipv6: scope exception invalidation to the affected nexthop David Ahern
2026-11-23 21:26 ` [RFC net-next v2 6/7] ipv6: make rt_genid_bump_ipv6() a plain counter increment David Ahern
2026-11-23 21:26 ` [RFC net-next v2 7/7] ipv6: stamp dsts with the generation sampled before the FIB lookup David Ahern
2026-11-24 16:35 ` [RFC net-next v2 0/7] ipv6: validate dsts against the netns route generation at lookup Ralf Lici
2026-11-24 17:15 ` David Ahern
2026-11-24 20:46 ` Ralf Lici [this message]
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=20261124204623.45969-1-ralf@mandelbit.com \
--to=ralf@mandelbit.com \
--cc=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
/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