🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24647

[BUG] xfrm: iptfs: reassembled inner packets end with the outer frame's Ethernet header (virtio-net, 7.0 to 7.4-rc5)

#24647
From: Duncan Austin
Date: Mon, 30 Nov 2026 14:40
181 lines
16696 bytes
When IP-TFS reassembles an inner packet that was split across two outer 
ESP packets, the last bytes of the rebuilt packet are sometimes wrong. In 
the clearest cases the final 14 bytes are the Ethernet header of the 
received outer frame: destination MAC (the receiving NIC), source MAC (the 
upstream router), ethertype 08 00. In other cases the tail is zeros or 
unrelated data. Packets that are not split are delivered intact.

- 7.0.0-44 (Ubuntu 26.04): silent corruption; XfrmInIptfsError rises by
   thousands per second under load.
- 7.3.6 (mainline build): a page_pool warning in page_to_skb, then
   "BUG: Bad page state" (refcount -1) and a crash within minutes.
- 7.4.0-rc5 (mainline build): no warnings in a short run, but the same
   14-byte Ethernet-header corruption and about 1,000 XfrmInIptfsError
   per second.

It is receive-side: the corrupted bytes only exist in the frame the 
receiving host got from its own NIC. Receivers are virtio-net guests, 
where receive buffers come from a page pool.


ENVIRONMENT

   Routers:       Ubuntu 26.04.1 LTS guests, 4 vCPU, QEMU q35 on Proxmox
                  VE 9.2 (host kernel 7.0.14, QEMU 11.0.3)
   NICs:          virtio-net, queues=4, rx-gro-hw off (to avoid a separate
                  UDP-tunnel GSO issue)
   Kernels:       7.0.0-44-generic (Ubuntu), 7.3.6-070306-generic and
                  7.4.0-070400rc5-generic (Ubuntu mainline builds)
   IKE:           strongSwan 6.x, IKEv2, PSK, aes256gcm16, Child SAs
                  mode = iptfs, replay_window = 1024
   IP-TFS:        packet_size = 0 (path MTU), dont_frag = no,
                  reorder_window = 8, drop_time = 30000, init_delay = 0
   Interfaces:    XFRM interfaces (if_id), one per tunnel, MTU 9000;
                  OSPF over them
   Outer path:    Internet, MTU 1500, native ESP (no UDP encapsulation)
   Inner traffic: VXLAN (UDP 4789) between hypervisors, carrying
                  1,500-byte VM packets, so 1,550-byte inner IP packets
   Sender TX:     single TX queue via XPS (all CPUs on tx-0), so ESP
                  leaves in sequence order; XfrmInStateSeqError stays 0

Addresses below are from our captures; we can supply full pcaps privately.


HOW TO REPRODUCE

Any traffic whose inner packets are larger than the IP-TFS outer payload 
(about 1,440 bytes on a 1,500-byte path) triggers it, because every such 
packet is split across two outer packets.

1. Two virtio-net guests (sender and receiver) with an IP-TFS tunnel
    between them, outer MTU 1500, single sender TX queue (or
    "ethtool -L <dev> combined 1") so ESP arrives in order.
2. Send TCP through the tunnel with 1,500-byte inner packets inside
    VXLAN, so each is 1,550 bytes. A sustained download of about
    650 Mbit/s was enough.
3. On the receiver, watch XfrmInIptfsError in /proc/net/xfrm_stat: it
    rises steadily (7.0: about 60,000 during one speed-test download;
    7.4-rc5: 21,358 in 20 seconds).
4. Capture the inner packets before encryption on the sender side and
    after reassembly on the receiver (tcpdump -s0 on the interfaces either
    side of the tunnel), match them by flow, IP ID and TCP sequence, and
    compare bytes.

With inner packets of 1,400 bytes or less (VM MTU 1350), throughput is 
normal and the end hosts see no damage. We have not yet measured 
XfrmInIptfsError at that size: IP-TFS can still split a packet that does 
not fit the space left in the current outer packet.


EVIDENCE

Offsets are into the VXLAN payload (VXLAN header onwards). "Before" is the 
packet as sent into the tunnel, "after" as it leaves the receiver after 
reassembly. bc:24:11:de:11:98 is the receiving router's own outer NIC; 
00:c0:89:4b:50:08 is its upstream router.

7.0.0-44: Ethernet header in the tail

   1522-byte packet, 14 bytes differ at 1508..1521 (the last 14)
     after  [1508:1522] bc 24 11 de 11 98 00 c0 89 4b 50 08 08 00
     before [1508:1522] d4 4a 97 2d b7 37 42 0d a5 3c 1c e5 46 af

In the other direction (another receiver running 7.0), damaged packets had 
16 to 38 bytes changed at the end, sometimes zeros:

     before [1484:1500] 02 64 1e 43 9a e9 de a7 0b 32 14 7a 67 f6 0e ad
     after  [1484:1500] 00 00 00 00 00 00 00 00 00 00 00 00 67 f6 0e ad

Some damaged packets had their inner TCP sequence changed as well, so 
could not be matched to any sent packet. The next hop's UDP checksum check 
caught about 9 per second (UdpInCsumErrors). Of about 19,400 matched 
packets, the rest were byte-identical apart from the normal inner TCP 
checksum fill-in.

7.3.6: page_pool warning, then bad page state

   WARNING: include/net/page_pool/helpers.h:297 at page_to_skb+0x4fb/0x5a0, 
CPU#0: swapper/0/0
     ... that boot ended (crash, auto-reboot) 43 s later; on the next
     boot, 43 s after start:
   BUG: Bad page state in process swapper/0  pfn:105844
   page: refcount:-1 mapcount:0 mapping:0000000000000000 index:0x1a3 
pfn:0x105844
   page dumped because: nonzero _refcount
   Call Trace (abridged): bad_page <- __rmqueue_pcplist <- rmqueue
     <- get_page_from_freelist <- __alloc_frozen_pages <- allocate_slab
     <- kmem_cache_alloc <- __nf_conntrack_alloc <- nf_conntrack_in
     <- ip_list_rcv   (iptfs_output_collect also on the stack)
   Modules: esp4 xfrm_user xfrm_algo xfrm_interface xfrm_iptfs
     nf_conntrack nf_tables ...

The allocation that tripped the check is the victim, not the culprit: a 
page was freed once too often earlier.

7.4.0-rc5: same corruption, no warnings

   1510-byte packet, 14 bytes differ at 1496..1509 (the last 14)
     after  [1496:1510] bc 24 11 de 11 98 00 c0 89 4b 50 08 08 00
     before [1496:1510] 18 4d db b2 bc 38 bf d6 f7 f8 03 fe 75 48
   1475-byte packet, 14 bytes differ at 1461..1474 (the last 14)
     after  [1461:1475] bc 24 11 de 11 98 00 c0 89 4b 50 08 08 00

dmesg clean, 690 Mbit/s throughput, XfrmInIptfsError +21,358 in 20 s, 
XfrmInStateSeqError 0.


ANALYSIS

The damage happens on the receiver during reassembly, and the evidence 
points at how the continuation bytes are taken from the outer frame.

- Receive side. The 14 bytes that appear are the receiver's own incoming
   frame header. The sender never had them.
- Only split packets. Damage is always at the end of a rebuilt packet,
   which is the part carried in the second outer packet. Unsplit packets
   arrive intact.
- Exactly 14 bytes, ETH_HLEN, in the clearest cases. The end of the
   copied range seems to be computed 14 bytes short, or the tail is read
   from the start of the receive buffer, where the Ethernet header sits.
   The zeros and unrelated data seen elsewhere would fit the same fault
   landing on a recycled page.
- Page sharing. iptfs_reassem_cont() can append the continuation by
   sharing fragments of the received skb (iptfs_skb_add_frags()) instead
   of copying them. On virtio-net those pages belong to the receive page
   pool. 7.3.6's page_pool warning in page_to_skb and the refcount -1
   page suggest a reference on a pool page is taken or dropped wrongly.
   On 7.0 the same mistake would show as a page recycled and refilled
   with a new frame while a rebuilt packet still points into it.

Related recent fixes in the same code that do not appear to cover this (by 
subject):

- xfrm: iptfs: propagate SKBFL_SHARED_FRAG in iptfs_skb_add_frags()
   (CVE-2026-64566)
- xfrm: iptfs: fix stack OOB read in iptfs_skb_reset_frag_walk()
- xfrm: iptfs: linearize newskb before the copy fallback in
   iptfs_reassem_cont()

WHAT WE CAN PROVIDE

We can reproduce this at will on a test router and are happy to test 
patches against 7.4-rc or net.

- Paired pcaps (before and after the tunnel, 20,000 packets each) for
   7.0 and 7.4-rc5, shared privately.
- Full dmesg and journalctl -k for both 7.3.6 boots, including the
   complete page_to_skb warning trace.
- The comparison script that matches packets across the two captures
   and reports changed byte ranges.
- Our strongSwan and charon IP-TFS configuration.

All the best,

Duncan Austin

da@citrus-it.co.uk
-- 
Citrus IT Limited | +44 (0)333 0124 007 | enquiries@citrus-it.co.uk
Rock House Farm | Green Moor | Wortley | Sheffield | S35 7DQ
Registered in England and Wales | Company number 4899123
Technical Details
Message-ID: <7d11f88c-64d5-8790-8911-0f8544503e71@citrus-it.co.uk>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374251-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374251-linux-kernel-netdev=dewy.ru
From: da@citrus-it.co.uk (Duncan Austin)
Newsgroups: linux.kernel.netdev
Subject: [BUG] xfrm: iptfs: reassembled inner packets end with the outer
 frame's Ethernet header (virtio-net, 7.0 to 7.4-rc5)
Date: Mon, 30 Nov 2026 14:40:14 +0000 (GMT Standard Time)
Organization: Usenet Network
Message-ID: <7d11f88c-64d5-8790-8911-0f8544503e71@citrus-it.co.uk>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
Injection-Info: usenet.network;
	logging-data="1447073"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:uhOYOULIXRks7MOOl9wNZ8Hvsts= sha256:TnUcFRMUKWte3TLBg2jfSQ9/Qcd375buQTOOGaKXxuk=
	sha1:Mx5bOWFJLCDNNQQ4aXb+IgMkooM= sha256:aqPg3fHTqzAPABANjikgGywaCYozHhu27j6lbtaktl4=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id DD086125FF1; Mon, 30 Nov 2026 17:40:43 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.151
X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=citrus-it.co.uk
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id tyygfc7sEQrM;
	Mon, 30 Nov 2026 17:40:40 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-374251-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=citrus-it.co.uk
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 00A2D125FED; Mon, 30 Nov 2026 17:40:30 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 3BF5D602827; Mon, 30 Nov 2026 14:40:30 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796049627;
	b=hRPhKBhVrCET90V360KRvhQt9+kxC2nlKVXooJKzW8qfU+Z2YEjESH3Amrm06ym9aWif
	 3apFPA9yiCCVKSzfJt9xWuLR/aywEKvw9XNas0Z/JqD7lkBHogiAYkws8esqe5UU50zl3
	 RVqssOSCn3sh3MFtuVeQIQRRDtMLEAYzpuTqbMLzyHTdNQFl2t2E/2f+R0LD57TKl54R+
	 2Yz+IhJ/TqvetfBzkJpXH7D0QtVA9yieIXVuPS/l/mVujcen+S7HPO/f+KpI7IPfo5ZCd
	 bhiAqWLJkl5J5/DMAbh4dQLrTqGmTP+heAyHk+XtEorkY1WubYPXQnZSr8JDtEpRzcg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796049627;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date:
	 From:To:Subject:Message-ID:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Type:X-Citrus-Version:X-Citrus-ID:X-Citrus-Virus-Scanned:
	 X-Citrus-Spam-Score:X-Citrus-Spam-Report:X-Citrus-Spam:
	 X-Citrus-Trust;
	bh=tHYrrWb3FVTJ8Xoc9iyvWxpyhT9CQ5hE/TyNBMi5kBE=;
	b=UtGFj0dgb8bJBe+xdWxBwChiIcHmgNCTGyjo7Z3jFwfWu8LjUbDuteQKxPn74pxH7PiR
	 7zOIqbLmQxrBl7J2ijejwTQTkrRywBKR9kEpzKKywZpXYha/9QS/n7ixUyF+Xk3SZuFRc
	 u/3nL8lNFG3dZnF/FaN7tdq4lRhSI5DONriU6P7XGUREiAEn1X3nJolELE6zDOmsHFVCp
	 kzdujVG/TPd+3ii4iqySI4UWnYsdizIUJtrgnWzVeH2PcaBl1VGQDPf3sKEIFaN32XW2R
	 H6v1jc4B1By+rtbylfVUnuhkPTJMXuzEat6vKRjMc5kWWraYwVhzLMiiYbDTzIO3tdw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=citrus-it.co.uk header.i=@citrus-it.co.uk header.a=rsa-sha256 header.s=moruga header.b=Ebht5gkm;
	dmarc=pass header.from=citrus-it.co.uk;
	spf=pass smtp.mailfrom=citrus-it.co.uk;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 4DB93606A32E;
	Mon, 30 Nov 2026 14:40:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=citrus-it.co.uk header.i=@citrus-it.co.uk header.a=rsa-sha256 header.s=moruga header.b=Ebht5gkm
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=159.8.160.46
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796049626;
	b=F68dnmtELzI13Uy7796OlxxcLj2vIbAmKr6rJ95zll4B7boRA+YnpGfZPKPzjsouLJZu
	 9vW7qSD8ABEA4qVzVGStr7z5jxIteDcE9k607XwNrkhEULrGG1a8FEsVttZFJUq2LkOaG
	 GjKnAE9NsYEZ7XgICNIDXEMDEfg7WM9RBtFOZ4dsvMuhHwXkEweCD+6GvwnRQ9fuW92Yl
	 Q66FumJu4B20FWflgAWOlDPGsoPEwiB++b+HW80yDBehmHptg7C+EpjQGZn3NDuoMIUcF
	 t5hNGTTAOqbAErZkng4mEP712+NTWjLrTMgxgz+GeGL+AbYPs/x7Z2KGwhh+WHAI9Cw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796049626;
	h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Subject:Message-ID:
	 MIME-Version:Content-Type:X-Citrus-Version:X-Citrus-ID:
	 X-Citrus-Virus-Scanned:X-Citrus-Spam-Score:X-Citrus-Spam-Report:
	 X-Citrus-Spam:X-Citrus-Trust;
	bh=tHYrrWb3FVTJ8Xoc9iyvWxpyhT9CQ5hE/TyNBMi5kBE=;
	b=GbCwUogotxGVE2lgweIZeCghOhyS/fsUlHL/I6Xs9yEUxoMFsleeIKR6GAI4XQgyVv+8
	 fNCGDlSHmyVqwsFann19o8mA5HaU0yCbA7sxw20Tis8I91zDyF3L5HEbKCI2I8NYEXBRU
	 ByvZY78nJmzT9elIJKVjZFhiyUS3Y7D8ccRKv60GQLVpat8h3AfygQ5NbbMJLkWkIEn2h
	 UQQZMM1qq8jQEA6+hst6wWXAj4lM53c26YCG+UPl+e44d2BbPZBYA20JoS2KJ4EO3kziM
	 yWe7Qn84b80jdnLrhqBHhL8UPVCAethfNsr+cHMZnFgGje+H8I/ntWjUwvSUjqx9vrQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=citrus-it.co.uk;
	spf=pass smtp.mailfrom=citrus-it.co.uk;
	dkim=pass header.d=citrus-it.co.uk header.i=@citrus-it.co.uk header.a=rsa-sha256 header.s=moruga header.b=Ebht5gkm;
	arc=none smtp.remote-ip=159.8.160.46
X-Received: from mail.citrus-it.net (trinidad.citrus-it.net [159.8.160.46])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA675606A68C
	for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 14:40:24 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EA675606A68C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=citrus-it.co.uk
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=citrus-it.co.uk
X-Authentication-Results: citrusmail; dkim=pass header.i=@citrus-it.co.uk
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=citrus-it.co.uk;
	s=moruga; t=1796049615;
	bh=Pl0U1F6V6UuC6tB8VgbLtpwQpr3oAi5nTfI2Hu6cNmU=;
	h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type;
	b=Ebht5gkmfeHF4ky+Bf3JITGyx8dAdZ4/0Ym2JdVxfhoKXV6hvYgyFZ/1uhnPDWs1/
	 Gedb1vT/JoikJl5sHA+kqecvIkmStMqzN13BT+rlsCm/1JFEmyYyxVOoxvPsgyxFRZ
	 CBhHlE89hNNUg9mp3apf4PFaQqVQDHsEmoU1ChiQ=
X-Received: from lon-desk-duncan.acdt.co.uk (management.acdesktop.uk [159.122.228.254])
	(authenticated)
	by mail.citrus-it.net with ESMTPSA id 6AUEeEap025508
	(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
	for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 14:40:14 GMT
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-Citrus-Version: 6.0.708f41c
X-Citrus-ID: 106AUEeEap025508
X-Citrus-Virus-Scanned: Clean
X-Citrus-Spam-Score: -3.3
X-Citrus-Spam-Report: ALL_TRUSTED -0.01,SMTP_AUTH -3.3
X-Citrus-Spam: False
X-Citrus-Trust: Trusted