From: David Ahern <dsahern@kernel.org>
To: Ralf Lici <ralf@mandelbit.com>
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:11:28 -0700 [thread overview]
Message-ID: <f57bd1af-fac3-49e1-b0ce-4b980289fdd5@kernel.org> (raw)
In-Reply-To: <20261124204623.45969-1-ralf@mandelbit.com>
On 11/24/26 1:46 PM, Ralf Lici wrote:
> 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.
>
>
My set kept growing. I told claude not to add the order switching; you
have a patch for that which can go in as is. Not sure how much of the
above list is covered by my non-RFC set. That one kept growing through
the iterations with claude and sashiko/codex.
prev parent reply other threads:[~2026-11-25 4:11 UTC|newest]
Thread overview: 12+ 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
2026-11-25 4:11 ` David Ahern [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=f57bd1af-fac3-49e1-b0ce-4b980289fdd5@kernel.org \
--to=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ralf@mandelbit.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.