netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 0/3] net: fix lwtunnel reentry loops
@ 2025-03-14 12:00 Justin Iurman
  2025-03-14 12:00 ` [PATCH net v2 1/3] net: lwtunnel: fix recursion loops Justin Iurman
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Justin Iurman @ 2025-03-14 12:00 UTC (permalink / raw)
  To: netdev; +Cc: davem, dsahern, edumazet, kuba, pabeni, horms, justin.iurman

v2:
- removed some patches from the -v1 series
- added a patch that was initially sent separately
- code style for the selftest (thanks Paolo)
v1:
- https://lore.kernel.org/all/20250311141238.19862-1-justin.iurman@uliege.be/

When the destination is the same after the transformation, we enter a
lwtunnel loop. This is true for most of lwt users: ioam6, rpl, seg6,
seg6_local, ila_lwt, and lwt_bpf. It can happen in their input() and
output() handlers respectively, where either dst_input() or dst_output()
is called at the end. It can also happen in xmit() handlers.

Here is an example for rpl_input():

dump_stack_lvl+0x60/0x80
rpl_input+0x9d/0x320
lwtunnel_input+0x64/0xa0
lwtunnel_input+0x64/0xa0
lwtunnel_input+0x64/0xa0
lwtunnel_input+0x64/0xa0
lwtunnel_input+0x64/0xa0
[...]
lwtunnel_input+0x64/0xa0
lwtunnel_input+0x64/0xa0
lwtunnel_input+0x64/0xa0
lwtunnel_input+0x64/0xa0
lwtunnel_input+0x64/0xa0
ip6_sublist_rcv_finish+0x85/0x90
ip6_sublist_rcv+0x236/0x2f0

... until rpl_do_srh() fails, which means skb_cow_head() failed.

This series provides a fix at the core level of lwtunnel to catch such
loops when they're not caught by the respective lwtunnel users, and
handle the loop case in ioam6 which is one of the users. This series
also comes with a new selftest to detect some dst cache reference loops
in lwtunnel users.

Justin Iurman (3):
  net: lwtunnel: fix recursion loops
  net: ipv6: ioam6: fix lwtunnel_output() loop
  selftests: net: test for lwtunnel dst ref loops

 net/core/lwtunnel.c                           |  65 ++++-
 net/ipv6/ioam6_iptunnel.c                     |   8 +-
 tools/testing/selftests/net/Makefile          |   1 +
 tools/testing/selftests/net/config            |   2 +
 .../selftests/net/lwt_dst_cache_ref_loop.sh   | 246 ++++++++++++++++++
 5 files changed, 306 insertions(+), 16 deletions(-)
 create mode 100755 tools/testing/selftests/net/lwt_dst_cache_ref_loop.sh

-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-04-16  8:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-14 12:00 [PATCH net v2 0/3] net: fix lwtunnel reentry loops Justin Iurman
2025-03-14 12:00 ` [PATCH net v2 1/3] net: lwtunnel: fix recursion loops Justin Iurman
2025-03-14 12:00 ` [PATCH net v2 2/3] net: ipv6: ioam6: fix lwtunnel_output() loop Justin Iurman
2025-03-14 12:00 ` [PATCH net v2 3/3] selftests: net: test for lwtunnel dst ref loops Justin Iurman
2025-03-20 10:25   ` Paolo Abeni
2025-03-20 15:38     ` Justin Iurman
2025-03-20 16:46   ` [PATCH net v2 3/3] selftests: net: test for lwtunnel dst ref loops: manual merge Matthieu Baerts
2025-03-20 10:30 ` [PATCH net v2 0/3] net: fix lwtunnel reentry loops patchwork-bot+netdevbpf
2025-04-14 22:30 ` Eduard Zingerman
2025-04-15  9:29   ` Justin Iurman
2025-04-16  8:08     ` Eduard Zingerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).