Article View: linux.kernel.netdev
Article #26973[PATCH net v4 0/5] xsk: Keep the shared info of zero-copy buffers in kernel memory
From: Björn Töpel
Date: Fri, 04 Dec 2026 14:20
Date: Fri, 04 Dec 2026 14:20
81 lines
11798 bytes
11798 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 5 moves the shared info into the buffer pool and lets the device write up to the end of each chunk. Patch 2 makes libeth count XSk XDP_TX buffers one by one, as it read the shared info at a later bulk flush. Patch 1 makes libeth count completed XDP_TX buffers up, as idpf subtracts them. Without it the count of patch 2 still goes the wrong way. Patches 3 and 4 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 3 earlier [2]. Patch 4 was reproduced on igb in QEMU. v4 was tested on igb and veth in QEMU, v2 also on virtio-net and on mlx5 hardware. None covers multi-buffer zero copy, XDP_TX on idpf or the generic skb builder, so i40e, ice, idpf and gve are only build-tested, patch 1 included. Intel folks, could you run your multi-buffer zero-copy and XDP_TX tests on them? Changes in v4: - New patch 1: count completed XDP_TX buffers up in libeth. v2 left it for a separate fix, but patch 2 depends on it (Sashiko) - Patch 2: count up after patch 1, and describe a frame cut short by a full XDPSQ (Sashiko) - Patch 3: give the worst case, the whole shared info (Sashiko) - Patch 5: state what a forged shared info allows, and the privilege it needs (Sashiko) - Add Maciej's reviews, rebase on net 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) v3: https://lore.kernel.org/netdev/20261203095647.3448925-1-bjorn@kernel.org/ 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 (5): libeth: xdp: Count completed XDP_TX buffers up 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 | 10 +++-- include/net/libeth/xdp.h | 11 +++++- 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, 99 insertions(+), 65 deletions(-) base-commit: 19727ac1afdaa3dac66e0f75daca7c3d156e1ca9 -- 2.53.1
Technical Details
Message-ID:
<20261204142030.626820-1-bjorn@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.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-377409-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.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-377409-linux-kernel-netdev=dewy.ru From: bjorn@kernel.org (Björn Töpel) Newsgroups: linux.kernel.netdev Subject: [PATCH net v4 0/5] xsk: Keep the shared info of zero-copy buffers in kernel memory Date: Fri, 4 Dec 2026 15:20:20 +0100 Organization: Usenet Network Message-ID: <20261204142030.626820-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="2782430"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Blm9ioDphGrza6aEGcjKh2pnzcU= sha256:yIfGG+MCd/XTc6jVUqNwc1uiI1/gkVcCSx0s8fvxR64= sha1:9S51vLIRL07VtMdkDF1q134sgQU= sha256:ewfUMBgO7YtC44HrM5dudODJDAXqRBb4a4p/4pBuVzA= 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 A67B8117C26; Fri, 4 Dec 2026 17:21:04 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.642 X-Spam-Status: No, score=-3.642 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.142, 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 PH9zWsXX9FY6; Fri, 4 Dec 2026 17:21:01 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377409-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id E6B85117C03; Fri, 4 Dec 2026 17:20:52 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 63B282ECB9; Fri, 4 Dec 2026 14:20:49 +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=1796394046; b=eYAt/1twwMInYpVlSpC9rljCf1GkpAFu9//IAyf3eACPP8O4DYPUYreSvEFJTT3TkloI OUgTEuPiFBoKSL0pS4G4+7HlFjoNtHqOTX7ahC2XTuJJbVJrHcF4XA8/atXub3KkCTIl1 pqCuzIPpMDoQOrdrkFarqKOxHPYCD/0Up0MGIG3JBEArKcrVXN4nTVAFeB6ccBtTN22sH B+eLLQAOIXNdW7uHo+ZefbksyeKdzYLhkzqaO86islEg+4GEjG4uFufDbrXxRZkGBY7LF xOZUFGLcHOEh+onbm/OPLRNaFuB/RYksJAt5O4puKOIqD8W+pcbcGWStCKWCqh9lEwQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796394046; 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=TkWbHiQGmULa41vijPyVnPZkiPR1odfzT0jFKEEkTz4=; b=rBuAM1yQJqeercIg6mc2+8DihNEd3QedbGEHzmPS+NRaxv+XD7gLbdIwT+wESFeL0T3a AGJGavNZGY70hR2wkaeNoahvRR2C4YGEROue9Z3j9tO1uekuYZT9DdG7kDAT60i5cNU3B ZoVjXrHxNlNoLXjPGsGXnQWIxXAIuwPJFhnO6pYkTgk9JJA4f46eCs1tTi+FP8nyeYGtT VtAJJctwQ8v5N69E2NgKxRL7pJRP+7O3IF7h9lFIxWuP0ytKHPwWxQs7AihBgpEbbpnMo bfbYbiP5yoF6dS9VX0rP1AgjsAlDvAeGOR8S9Pc1TSosJslGpN7sRNf/wM6s93sTTHg== 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=AyWMg9uX; 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 172AB606A338; Fri, 4 Dec 2026 14:20:46 +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=AyWMg9uX 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=1796394045; b=gHrh0TEs9n24yidu2Fnw/kQGzu9eu2xr9l5nkqxrlh87yWhbaha3HNoiXZLgZPJ3LSHr TIkwfGxAw4JEEdIjaM0iTOeEwzzfOyNj5eCFSOmiup2pDYm0xx8KZocLPr2hYWd9ZI4eg RiT2u09FSIVrwdWnRzhn1f3wJzoPoJO4uu3gW/edUdd3/M8mfAPgfNxfLNWmtLRIX3pcL K2XaGCUrH5xIOTL4s/Ei6T3UzPm3Nly9ptMS2sQ0TIKBaGflMQ6hBpQFTpUvL78sW2yDv RIqlHP7Ra62umJXHe0HxjHYMAAZAkZXZIXAKJahQ+m+JpF5ZP69G+u50CE7RBwD3dMg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796394045; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=TkWbHiQGmULa41vijPyVnPZkiPR1odfzT0jFKEEkTz4=; b=VH/EGkHTkypChtEES23HATFvF0jQ9cdr8f86XQr/fqxrbz7mI+XL5iBvUheu1vnnd5cu VysV786rwv+kUu+C1gGnC1jDdHoMpzKdfyShOyhCy6gVZg4PSY4jREveoBbDU/T9U48KG AtNoV9IVKTndZm9erxAx7W/ri0T6Few2HeJZcZVPI+SzFjPzYVXxA4yNL1+kxwAHe1D3b G8aT5D668WtbtHLmYKU5hZ5HQoG1bZrmyp+lVI3S0I/RjdHuXubPh30WEKB4x6ISmxgAe HfpdOehfdrP0MFEsmS/sL8bx/bd8TG5NLNIHRycf9nhlqZ/SXhVrmJa2whvOuKnOnOQ== 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=AyWMg9uX; 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 3253A606A322; Fri, 4 Dec 2026 14:20:44 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 305241F000C2; Fri, 4 Dec 2026 14:20:38 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796394044; bh=TkWbHiQGmULa41vijPyVnPZkiPR1odfzT0jFKEEkTz4=; h=From:To:Cc:Subject:Date; b=AyWMg9uXAMyZFa7t27rFsrTtjALUvSOx2CXhamAJi6uIHRuDzLG5psgBCQ9qDAQKZ 7W8dN0KSlyr3EDF05RJ+HSUJw/m2e0ouOjj/NNoeN89S3ZEB9y9sq+CzvH8Bk912IF JwWQyCr1YM+CBLDynvs7unqfM0zI/y0qQhDQD6Bk9SEfzKsvox9CXhz3aj1LCOanto t534aaeS2I6x6bIeba9TYW5TaO4Rh4UJYyK6IEq48oGIi7Edi3xuHk7XG3U2T0x9QY cD+6V9Ff8tKCdY+J984FvIn7Es/J4qVCTxaKc3aoIWw55lZGRKV/mNnZkC8ecSb9F0 /JIGmkO9hMeyA== 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>, Michal Kubiak <michal.kubiak@intel.com> 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