🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26259

[PATCH net v3 0/4] xsk: Keep the shared info of zero-copy buffers in kernel memory

#26259
From: Björn Töpel
Date: Thu, 03 Dec 2026 09:56
68 lines
11177 bytes
A packet that AF_XDP receives in zero-copy mode over several buffers
keeps its shared info, the fragment list and its count, in the UMEM,
which userspace can write while the kernel uses it. A rewritten list
or count makes the kernel read and write out of bounds.

Patch 4 moves the shared info into the buffer pool and lets the device
write up to the end of each chunk. Patch 1 makes libeth count XSk
XDP_TX buffers one by one, as it read the shared info at a later bulk
flush. Patches 2 and 3 fix skb builders that relied on the old
tailroom. The generic one sized the skb head from the frame size, and
i40e, igb, igc and ixgbe read past the data.

Sashiko found the issues [1], Clément the one of patch 2 earlier [2].
Patch 3 was reproduced on igb in QEMU.

v3 was tested on igb and veth in QEMU, v2 also on virtio-net and on
mlx5 hardware. None covers multi-buffer zero copy or the generic skb
builder, so i40e, ice, idpf and gve are only build-tested. Intel
folks, could you run your multi-buffer zero-copy tests on them?

Maciej will send the ice fix that v2 mentioned. Thanks, Maciej!

Changes in v3:
- Patch 2: describe the 2K chunk case and its impact (Sashiko)
- Patch 4: give the shared info of the pool its own cache lines after
  the data path members (Maciej)
- Patch 4: say that backports need patches 1 to 3 (Sashiko)
- Add Olek's acks, rebase on net

Changes in v2:
- New patches 2 and 3 (Sashiko, Clément)
- Patches 1 and 4: kernel-doc, buffer flag and ordering fixes
  (Sashiko)
- Drop the selftest patch, it goes to net-next (Maciej)

v2: https://lore.kernel.org/netdev/20261130123737.125432-1-bjorn@kernel.org/
v1: https://lore.kernel.org/netdev/20261127142131.3527737-1-bjorn@kernel.org/

[1] https://lore.kernel.org/netdev/179561567996.3135.9952128421877275714@kernel.org/
[2] https://lore.kernel.org/bpf/20260629072300.1664622-1-clecigne@google.com/

Björn Töpel (4):
  libeth: xsk: Count each XDP_TX buffer on its own
  xdp: Size zero-copy skbs from the data, not the frame size
  intel: Copy the exact length of XSk packets to skbs
  xsk: Keep the shared info of zero-copy buffers in kernel memory

 drivers/net/ethernet/intel/i40e/i40e_xsk.c   |  3 +-
 drivers/net/ethernet/intel/igb/igb_xsk.c     |  3 +-
 drivers/net/ethernet/intel/igc/igc_main.c    |  3 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c |  3 +-
 include/net/libeth/tx.h                      |  8 ++--
 include/net/libeth/xdp.h                     |  9 ++++-
 include/net/libeth/xsk.h                     |  6 ++-
 include/net/xdp.h                            | 32 +++++++++++++---
 include/net/xdp_sock_drv.h                   | 26 +++----------
 include/net/xsk_buff_pool.h                  |  2 +
 net/core/filter.c                            |  2 +-
 net/core/xdp.c                               | 40 ++++++++++++++------
 net/xdp/xdp_umem.c                           |  3 +-
 net/xdp/xsk_buff_pool.c                      | 20 ++++++----
 14 files changed, 97 insertions(+), 63 deletions(-)


base-commit: 7c13d5d5afb4ba2e8634fe5aa0a9f2bca235cb4b
-- 
2.53.1-Meta
Technical Details
Message-ID: <20261203095647.3448925-1-bjorn@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376461-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376461-linux-kernel-netdev=dewy.ru
From: bjorn@kernel.org (Björn Töpel)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v3 0/4] xsk: Keep the shared info of zero-copy buffers in kernel memory
Date: Thu,  3 Dec 2026 10:56:41 +0100
Organization: Usenet Network
Message-ID: <20261203095647.3448925-1-bjorn@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2453571"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6XxaaS9EbtURj1N4/nJOPJwJ5Rk= sha256:lyztKJcQsDR6FTUjdSnZJ9ec0F+ku67cj30SI8tyokQ=
	sha1:cKUfg4FS+sb1iK4iW3qp7H/e2P8= sha256:CxhsLKqJe59Qicmz9ucdPdfu4gI9eyJHgHWMAUuKFdE=
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 83FE41178B8; Thu,  3 Dec 2026 12:57:23 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	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 (2048-bit key)
	header.d=kernel.org
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 qK5wCLOtkJTI;
	Thu,  3 Dec 2026 12:57:19 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376461-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 38EB61178B0; Thu,  3 Dec 2026 12:57:11 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7336326ADD; Thu,  3 Dec 2026 09:57:09 +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=1796291829;
	b=itKvQi7G+JQIMVYMwjNn1L2amFqBhfoxKzz64KNs6sjaDI7+7HcTTX4b3e60vFGjjH4z
	 ng/QR8uye3kpWBwwUSBzq1Ta5BLGA4S2PivpFEm17YNyt4Ak7V0Zj9Q/3GXDtkrsuIS0a
	 T9un3oFpwH610zyUtP9xOY7aFJRIXmEQvyVIla8hRqzlT/vY84IYEa9Rz+t/8+HyhxGVv
	 87jfOJy9IAuz4ialVU++j4ImJ3J+LIr6aWjPZcuhPgID7RVk1ZqJDuoaZhcSyV6PhgnWC
	 t9V9teHs9sOUSwha9QEpYjKkdbvHwFsiuQ68I7PVLnEiq91PGGr0pTRsuKefQQzKqlg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796291829;
	h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Type:Content-Transfer-Encoding;
	bh=l9NxrBgmHS6rm7EbVEbRdzjxIk56TUV1181jEpA+93g=;
	b=hV3JWZLfCsbmCqTzw/W6UvaGeZaigL/oQEwGjEHWsVlSQurfpLl2IG/FOqYli0rE8orh
	 5ELMQ1Disbcn125Ak/3BWaHsGV/HCCLezZKahCikm+ai/mBZKkIqZWSmP3WBeX3/kZToj
	 4cfZOYnA+XoobkDS7muOuwjvPNpJFXqDHQ0C/HJGKSBcjcf5CKKvHZQCizCKl9dVgJoQX
	 ybbuTf4m5H6ViGYPKyTob0GOLsJxKutQAROcH0jeZx+Ntd/0//RTD0/5M9p52suzMiqw+
	 dG72MP1M0FVK6TFD9Ijf1Uhi8VOeyxxmyenLJRWaOaLlaJIvqQxm2fPZBLdSdKqG8KA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nlVcfZGa;
	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 43D04606A32F;
	Thu,  3 Dec 2026 09:57:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nlVcfZGa
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796291823;
	b=WMlEsC6xxpQu5Hd6xrF9Ssq+F/Cia/Ia0xV8dsVkYax+nDmoHMNwziPYWn4A6hQItLGL
	 Svqnnj5YX8Q8mKI3823JrsHiqG8gnGkVdY51DXBWbGhMgjzymqhQbbu2KdZRXZBIVVTmI
	 IufPUsOkwxjkplUosnzpKB/oTB9itrkqas0kb6a0WjEm47/0gXVRBrOK2jW2HKgqDDgcd
	 X+iXqd7DB8NNM/66Pd7cUbbbm3og+nOAwUSklvOiDKQThjtA/WHdcfdjR0TBlZy2AouTc
	 9I+k9Pt46wJX6/CtBrPQN9NfpwQhuPsro8JwdyVpODYKkY80L+8l5oSH++Z39Xx37/A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796291823;
	h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=l9NxrBgmHS6rm7EbVEbRdzjxIk56TUV1181jEpA+93g=;
	b=NBNRlpOWS+CQyQ6JUEcywOIc5FpYtS53dO6hjPnAepdbkWS7cfn39V40FluM3xmhEKdc
	 evuOPFXF7cref5pOeGZ/Y01rJ2a6xBakLE/1A5/j6yctv/9cyXFvWEADkTMUAjMl0/+iF
	 Ul4tr5F/Olj+l4Rlg1W6FizDFBv88Qa1zyiK0bsMG4I8uT+CbzCmw6Q6hWo4nCCDmdF4b
	 TpLUxfDTjJBLJyJGxzJvExBDb5vQOuXaI/Ufw45AzHK2XkHIdC7fxcR+W88rcz1ZqgkTT
	 bUKM52UmAXc1tEc70xIxf8nUoXfcBjTOAc/l5sM+C3AR+s2uV3bPO3TNmMowRcVGbhg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nlVcfZGa;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DCD4606A322;
	Thu,  3 Dec 2026 09:57:03 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B4001F00893;
	Thu,  3 Dec 2026 09:56:57 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796291823;
	bh=l9NxrBgmHS6rm7EbVEbRdzjxIk56TUV1181jEpA+93g=;
	h=From:To:Cc:Subject:Date;
	b=nlVcfZGa8bOQheDo3yqIgEr4URkEQzeotU+B7GJc44DU0cbJjNrT60Vhki/SbKjtx
	 2LZGRA3zORge36FD4EfTH17MJjYpqxkEBWIuKDUxe0FP1uVtzsGqpSxd/cKxkoEfCL
	 pCpjmo1XxAntnTer+yu5vJFXiHBqPFPnEtSgqMbRANLY9jiFAdjPZVKkG9J5WuiTFG
	 Ef1k7wSMa3MGqrZ7IuCDJNSPLzd4o06hRwHUmPnoAtHdnaR+nc7VjhZySywI99K76A
	 Y6a2u7qGT04RzlmYrGE6Oc/UG5s2yZfp7LlfnAh3IBejSEaiuHhlJ4TW+Tn5Re6RXp
	 Sb3NHIVvukZdQ==
X-Cc: Björn Töpel <bjorn@kernel.org>,
	Simon Horman <horms@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	Jiri Olsa <jolsa@kernel.org>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	Ihor Solodrai <ihor.solodrai@linux.dev>,
	intel-wired-lan@lists.osuosl.org,
	Clément Lecigne <clecigne@google.com>,
	Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
	Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>,
	Kurt Kanzenbach <kurt@linutronix.de>
X-Mailer: git-send-email 2.56.1
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