From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 F149D606A32C for ; Thu, 3 Dec 2026 09:57:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=t1QFt8as; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nlVcfZGa Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C7ED360AC1; Thu, 3 Dec 2026 09:57:06 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Qx5lqdau9BPR; Thu, 3 Dec 2026 09:57:06 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org F20A561031 Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796291826; b=RFTqx8DkEieOr+nMAXXcb/BwzwSHJqQ2LWRsPxha1dvQAbG9EXdef/OnY1zpPkcQH67Y tqRAR3jiGDryXwQPtePwUqO+jfOWoMNqKSHDxW0V/e2IPgjn50tGJRzUOKOzav3MU/qf3 H9O1zkySK9BWoHtfkUYzlqJTmF96bvoY0CoACaoQGjQvOm7cIJ+OqYSweere+yEwSLOon JDLGNnaSTrg/Y746C7Fh88GppxTyI7xQ5y8zcpK/andGV0lxKXKzAPtg1zFxOj5TID5an uzFFkvcrOJcbRlDqOPDJxcbtrIHDTrGmxjn8QeBSqQK1UVvo8SVv3OxAxFe0wC+HyuQ== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796291826; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding:X-BeenThere: X-Mailman-Version:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Errors-To; bh=l9NxrBgmHS6rm7EbVEbRdzjxIk56TUV1181jEpA+93g=; b=K/W+67c6Eyl4ExPJeaK1bT3fT0FyrnIVi3g3cnvcMt/6ZEQB8RmKUdlFXQWeyo3P1tXE 2rKxFoHYdFHVoUntRjFmNT0DwbqUvye3cPXptHCb2v+ATb+p8QzzbIw8fir80lZMUBJLj YaTdBQFz28kovwMVWTDDyMZqNHjsJvMWAfxs+x0O/F2BWv1zc/1cipfc7qaq824vVoC+O IpQYWB6rIHGuPk0xWQlkE4L2aN4rIXGYQ8A92TOOAv9o/UjGpZ8L0mpqXfs45Gr2cZXFW nhIGesX5Ppy56YFO3ZwWBGMppvEdKdG1YoSmm4XHRL0YQV1GRdaORGiAceTZ7JKX6kw== ARC-Authentication-Results: i=1; smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1796291826; bh=l9NxrBgmHS6rm7EbVEbRdzjxIk56TUV1181jEpA+93g=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=t1QFt8asebzGodL2Z16sgWqD10ZUj09YpgKqeitMOM3UyrXtSJwwzGvvtCuti2SKJ /KErnLZKGycffV3OI/fJ0jvQbqZ9D1t4bwMGJWhreqnVBAwhrEWE+PyGODsv48ACNw ZLyj47Q7ByDWaUQfs9FctEoEWD6M3Yir5DUYMba+XY9NjGr2VdRlr0VPZSxua9MtH0 aY1YXMDlHpNSqFrlI/PIoUOXCHQICZWRrYwiw2LRPE4jd/5kJS2u6JXdGgBiInItmu horGlTuzM91WAGKquwUtOn2v7LXT6O48andsQcBDvK+iOwL+uyQoUF2FrPWilrpBWe RKFoNYAP2RLpw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id F20A561031; Thu, 3 Dec 2026 09:57:05 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists1.osuosl.org (Postfix) with ESMTP id 7A4FB2FF for ; Thu, 3 Dec 2026 09:57:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 6CC11409CB for ; Thu, 3 Dec 2026 09:57:05 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id RaRTkpiJ9YnM for ; Thu, 3 Dec 2026 09:57:04 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp4.osuosl.org 7F4FD409B9 Authentication-Results: smtp4.osuosl.org; arc=none smtp.remote-ip="2600:3c0a:e001:78e:0:1991:8:25" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2600:3c0a:e001:78e:0:1991:8:25; helo=sea.source.kernel.org; envelope-from=bjorn@kernel.org; receiver= Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nlVcfZGa Received: from sea.source.kernel.org (sea.source.kernel.org [IPv6:2600:3c0a:e001:78e:0:1991:8:25]) by smtp4.osuosl.org (Postfix) with ESMTPS id 7F4FD409B9 for ; Thu, 3 Dec 2026 09:57:04 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 5279341275; Thu, 3 Dec 2026 09:57:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B4001F00893; Thu, 3 Dec 2026 09:56:57 +0000 (UTC) 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== From: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= To: Magnus Karlsson , Maciej Fijalkowski , Alexander Lobakin , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Andrew Lunn , Tony Nguyen , Przemek Kitszel , netdev@vger.kernel.org, bpf@vger.kernel.org Cc: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Simon Horman , Stanislav Fomichev , Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Ihor Solodrai , intel-wired-lan@lists.osuosl.org, =?UTF-8?q?Cl=C3=A9ment=20Lecigne?= , Michal Swiatkowski , Sriram Yagnaraman , Kurt Kanzenbach 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 Message-ID: <20261203095647.3448925-1-bjorn@kernel.org> X-Mailer: git-send-email 2.56.1 X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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