)]}'
{
  "commit": "49d6c6c88b9d6f495f45dcf622f86de65ade5eaa",
  "tree": "a25b7d9bd7b1ebb16482ae6605e9e494ea930d39",
  "parents": [
    "66a8ea84d849423c832910f3be3cabe1f2dd0d56"
  ],
  "author": {
    "name": "Guoshuai Yang",
    "email": "yangguoshuai@gmail.com",
    "time": "Wed Oct 28 06:57:10 2026 +0800"
  },
  "committer": {
    "name": "Steffen Klassert",
    "email": "steffen.klassert@secunet.com",
    "time": "Thu Nov 05 10:18:15 2026 +0100"
  },
  "message": "xfrm: esp: reset outer TCP GSO metadata on espintcp input\n\nWhen ESP packets are received over TCP (RFC 8229 espintcp), strparser\nslices individual length-prefixed ESP records from the outer TCP stream by\ncloning the incoming TCP skb(s) in __strp_recv().\n\nIf the outer TCP skb was GRO-coalesced before reaching strparser, its\nskb_shinfo carries the outer TCP stream\u0027s GSO metadata (gso_size, gso_segs,\nand gso_type). When an ESP record spans two outer TCP segments, strparser\nchains the spillover clone onto skb_shinfo(head)-\u003efrag_list.\n\nSubsequently in esp_input() and esp6_input(), skb_cow_data() unshares the\nhead skb via pskb_expand_head() (preserving the outer TCP gso_size and\ngso_type in the new private skb_shinfo) and calls skb_copy() on each cloned\nfrag_list member, which copies the outer TCP GSO fields via\nskb_copy_header() onto a linear frag_list child skb allocated from slab\nwith head_frag \u003d\u003d 0.\n\nFurthermore, on kernels with TCP fraglist GRO support, if an outer TCP GRO\naggregate carrying SKB_GSO_FRAGLIST reaches the espintcp socket unsegmented\n(for example, when rx-gro-list is enabled on a device in an outer netns\nwhere tcp4/6_check_fraglist_gro() finds no local socket and the aggregate\nis forwarded across a NETIF_F_GSO_FRAGLIST-capable veth device into the\nnetns hosting the espintcp socket) and is chained onto\nskb_shinfo(head)-\u003efrag_list by __strp_recv(), skb_cow_data() invokes\nskb_copy() / skb_copy_expand() on that frag_list member and hits\nWARN_ON_ONCE(skb_shinfo(skb)-\u003egso_type \u0026 SKB_GSO_FRAGLIST), failing with\n-ENOMEM before decryption even begins. (On older stable trees without TCP\nfraglist GRO, the pre-pass is a no-op.)\n\nAfter ESP decryption and header removal, the resulting single inner packet\nstill has skb_is_gso(skb) \u003d\u003d true with the stale outer TCP gso_size, while\nskb_headlen(head_skb) is now smaller than that gso_size due to stripping\nthe outer framing and ESP header. When this packet passes through\ngro_cells_receive() (which flushes frag_list packets via GRO_NORMAL\nwithout resetting gso_size) and is forwarded, validate_xmit_skb() invokes\ntcp_gso_segment() -\u003e skb_segment(). Because head_skb is shorter than the\nstale gso_size and SKB_GSO_DODGY is not set, skb_segment() attempts to map\nthe slab-backed frag_list member as a scatter-gather page fragment where\nlist_skb-\u003ehead_frag \u003d\u003d 0. On current mainline kernels, skb_segment()\ntriggers DEBUG_NET_WARN_ON_ONCE(1) and fails with -EINVAL, causing\nvalidate_xmit_skb() to drop all multi-segment espintcp packets. On stable\nkernels prior to the removal of BUG_ON(!list_skb-\u003ehead_frag) in\nskb_segment() (such as 6.12.94 where this trace was captured), it crashes\nthe kernel:\n\n  Internal error: Oops - undefined instruction: 0 [#1] SMP ARM\n  PC is at skb_segment+0x574/0xd20\n  LR is at skb_segment+0x884/0xd20\n  Call trace:\n   skb_segment from tcp_gso_segment\n   tcp_gso_segment from inet_gso_segment\n   inet_gso_segment from skb_mac_gso_segment\n   skb_mac_gso_segment from __skb_gso_segment\n   __skb_gso_segment from validate_xmit_skb\n   validate_xmit_skb from __dev_queue_xmit\n   __dev_queue_xmit from ip_finish_output2\n   ip_finish_output2 from ip_output\n   ip_output from ip_sublist_rcv_finish\n   ip_sublist_rcv_finish from ip_sublist_rcv\n   ip_list_rcv from __netif_receive_skb_list_core\n   __netif_receive_skb_list_core from __netif_receive_skb_list\n   __netif_receive_skb_list from gro_normal_list\n   gro_normal_list from gro_cell_poll\n\nSimilarly, if a decrypted inner packet with a frag_list later takes the\nip_do_fragment() frag_list fast path, each detached frag_list member is\ntransmitted as a standalone IP fragment and would still carry the stale\nouter TCP GSO state when reaching validate_xmit_skb(). And even when an\nESP record does not have a frag_list, leaving the stale outer TCP gso_size\non the decrypted inner skb prevents dev_gro_receive() from initializing\ngso_size to the inner packet\u0027s skb_gro_len().\n\nWe cannot reset GSO state earlier in espintcp_rcv() / handle_esp() because\nthe skb may still be a clone sharing skb_shinfo with the outer TCP skb held\nby strparser. Instead, in esp_input() and esp6_input():\n1. Prior to skb_cow_data(), unshare/unclone and reset GSO metadata on any\n   frag_list member carrying SKB_GSO_FRAGLIST (unsharing any shared\n   predecessor frag_list members along the walk) so skb_copy() /\n   skb_copy_expand() inside skb_cow_data() does not hit WARN_ON_ONCE() and\n   drop the packet.\n2. At skip_cow, where the head skb and all frag_list members are guaranteed\n   to be uncloned with private skb_shinfo, call skb_gso_reset() on both the\n   head skb and each skb_walk_frags() member.\n\nFixes: e27cca96cd68 (\"xfrm: add espintcp (RFC 8229)\")\nCc: stable@vger.kernel.org\nSigned-off-by: Guoshuai Yang \u003cyangguoshuai@gmail.com\u003e\nSigned-off-by: Steffen Klassert \u003csteffen.klassert@secunet.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "322950727dd0a1589042cb3f5ac591d44c7bdfb9",
      "old_mode": 33188,
      "old_path": "include/net/esp.h",
      "new_id": "83c75ef59482889403d9cb349b5a76b04b1ac06f",
      "new_mode": 33188,
      "new_path": "include/net/esp.h"
    },
    {
      "type": "modify",
      "old_id": "ae701561d9f1201e2a2260704af315983e99498f",
      "old_mode": 33188,
      "old_path": "net/ipv4/esp4.c",
      "new_id": "111bea0bd26019a0a5ce0bd8431516a411d28c74",
      "new_mode": 33188,
      "new_path": "net/ipv4/esp4.c"
    },
    {
      "type": "modify",
      "old_id": "d654f0f44238830315ce1fcbd8f9a9795af1df26",
      "old_mode": 33188,
      "old_path": "net/ipv6/esp6.c",
      "new_id": "b287c807b0186fe9868ce16f7a649f1711f2a236",
      "new_mode": 33188,
      "new_path": "net/ipv6/esp6.c"
    }
  ]
}
