Re: [PATCH net v2 1/1] ip6_tunnel: snapshot encap in xmit
From: Ido Schimmel <idosch@nvidia.com>
Date: 2026-08-09 12:33:48
On Sat, Aug 08, 2026 at 07:38:52PM +0000, Kuniyuki Iwashima wrote:
From: Ren Wei <redacted> Date: Sat, 8 Aug 2026 16:40:49 +0800quoted
From: Zixuan Chai <redacted> ip6_tnl_changelink() can update encapsulation parameters while the netdevice is transmitting packets. ip6_tnl_xmit() can calculate packet headroom with t->encap_hlen and later build an encapsulation header from the live t->encap. A concurrent update can change the encapsulation header between these accesses and make skb_push() underflow the skb head. Take a local snapshot of t->encap before calculating the encapsulation header length.This intorduce per-skb cost in the fast path for unlikely changelink.
Assuming the common case where the tunnel doesn't use fou / gue encapsulation, the added cost is one compare and a copy of 8 bytes.
Right approach is to convert it to RCU pointer (and remove synchronize_net() there). 0ba269933f73 geneve: convert config to RCU-protected pointer 777434f53e77 geneve: pass geneve_config pointer to helper functions
It's on my TODO list since last week, but I don't have the time to work on it right now. It's a very large change (see the geneve change) that is needed across all the IP tunnels, not something that I consider suitable for net. What are you proposing for net?