Article View: linux.kernel.netdev
Article #24596Re: [PATCH net 2/3] xsk: Keep the shared info of zero-copy buffers in kernel memory
From: Björn Töpel
Date: Mon, 30 Nov 2026 12:05
Date: Mon, 30 Nov 2026 12:05
42 lines
10712 bytes
10712 bytes
Maciej Fijalkowski <maciej.fijalkowski@intel.com> writes:
> On Fri, Nov 27, 2026 at 03:21:28PM +0100, Björn Töpel wrote:
>> A packet that a driver receives in zero-copy mode over several buffers
>> keeps its shared info, the fragment list and its count, in the
>> tailroom of the UMEM chunk of its head. Userspace may write the UMEM
>> at any time, also while the kernel walks the fragments, and a
>> rewritten list or count makes the kernel read and write out of bounds.
>>
>> Keep the shared info in the buffer pool, which outlives its buffers
>> and the queues that point to it, and let the device write up to the
>> end of the chunk. One shared info per pool is enough, as a pool builds
>> one multi-buffer packet at a time. libeth read it later, at an XDP_TX
>> bulk flush, which the previous patch fixes.
>>
>> Multi-buffer pools now give the device the whole chunk, as
>> single-buffer pools already do, and allow a larger UMEM headroom.
>> bpf_xdp_adjust_tail() can grow a packet up to the end of its chunk.
>> Copy mode does not change.
>>
>> Found by an AI code review agent, in its review of another series.
>>
>> Suggested-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
>> Fixes: 24ea50127ecf ("xsk: support mbuf on ZC RX")
>> Signed-off-by: Björn Töpel <bjorn@kernel.org>
>
> I applied this change on top of my changes implementing xsk.py in drv-net
> selftests and gave this a run, plus a patch 3/3 was adjusted to fit the
> new python runner but intent stayed the same.
>
> Test used Intel's e810 (ice) back-to-back connection, 84 cases passed 0
> failed.
>
> Tested-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Thanks a lot! Sashiko found a few real issues, so v2 changes this
patch...
Björn
Technical Details
Message-ID:
<87y0aazfqa.fsf@all.your.base.are.belong.to.us>Path:
mbox-mo1.pugleaf.net!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-374154-linux-kernel-netdev=dewy.ruReferences:
<20261127142131.3527737-1-bjorn@kernel.org> <20261127142131.3527737-3-bjorn@kernel.org> <awnZgwW2z3fDj1Jx@boxer>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!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-374154-linux-kernel-netdev=dewy.ru From: bjorn@kernel.org (Björn Töpel) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 2/3] xsk: Keep the shared info of zero-copy buffers in kernel memory Date: Mon, 30 Nov 2026 13:05:49 +0100 Organization: Usenet Network Message-ID: <87y0aazfqa.fsf@all.your.base.are.belong.to.us> References: <20261127142131.3527737-1-bjorn@kernel.org> <20261127142131.3527737-3-bjorn@kernel.org> <awnZgwW2z3fDj1Jx@boxer> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="1419606"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:apHrsD9zQwvHKqZlXMsZuF0oP4U= sha256:DBrJjDihuazhzwHEoXjicPXAUme4vSG6+UjdelGEcXQ= sha1:WDpRytnRheWZtB6f0H7a4p4/Il8= sha256:fmTbBbq6qFGAQtpGJwNvKpyIiB5TCcr69f833tDHk9o= 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 A7DD5125FDF; Mon, 30 Nov 2026 15:06:11 +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 nHKCyeKyUBgq; Mon, 30 Nov 2026 15:06:09 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374154-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 A1772125FDD; Mon, 30 Nov 2026 15:05:56 +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 6895625B04; Mon, 30 Nov 2026 12:05:54 +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=1796040353; b=oGiQ1KgRaWjLVMULZTf9Hpb6X7d6+z9hHo/SFvXn9PJQVIGNLx/NdUCn8ItKj+yoEDmn nFXGv1qBZmR286ObbbCQhmksfjCL39Dy/wMtxiOUONhIa90r8ViXaIeeEImGXsE5HhCBe 0oJa1TLfu4bdakHqESedBn8lsrwtF39tXXqo9XcyLzKoGkhvCUO2afvEQiW/tSZnBvkjv 8i9KJb5B6NBEhDz7ZZNpw7fQPkUXJv9hmOtvILyjDOBP9Te8e6YIcWsJeVdyNK71lF1a0 2vIgQCZ9wRsRnamVbu80hzhd90zDxHAWDcsqtjTLLh09MQo3sxa5bSuAUUfeNJHN9vg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796040353; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: In-Reply-To:References:Date:Message-ID:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=Vmpj+dgt3SgVJ3+YtA1/zdKW3wNLlkWR2+/6TT50Lig=; b=LXCWzdG6ePpyD+AuHIY/eV1mZKxfu0YO8D1x6XIJIUVX/8Wlt5IQiI66gVJ+G4CTj9Ta DOZ1SPToFyE8TtSuGARTecIGcq8M38e3wahUKewAjm0L8NqKUNgGzqGenM3TalU16uGgF BWFRT/4Spwh9GyfQdfspgsjJHZcL9+c72SFUibznrGtzrpvuyloe2e5rglbNwJIo+tAjI 1s43/oEl5ZY9ucu23nR0PQvbHnxe5m1tD915Fa+IwoEV0DMnaKcHfk6uG2Q5mUTX/JkMr dvItwazDyKRNisZrP5PKD89nE0hslt4Cq2+LaAGn+lvBZLSqs1I/UKnXZzvFaXDS3qg== 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=hnegZSG5; 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 C714A606A330; Mon, 30 Nov 2026 12:05:53 +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=hnegZSG5 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=1796040353; b=tHJjCOerg0D5PF8q4MGGZvXhQlVjeAWshG1KNgrgA35CIp6zB90ueVlqIyMIK4diy4Nz qNmc5tmMwq/OJ7HxMmZvawJzYJxTswG20NOZ6Al2e2S8Nh4ptRFKMyTeW91eTu6UC66qx y978lUg9rD0nFYWQqQ6RNGek0ok8GrgknSj/z7kM9iJD6INaY1i2cBKqS0qft3PrpVlUx wqyfWJncZ6dPLivG/rYb+oWEJkMZNDkniKRVA8xnR6Q/iVFXBm80x8S7Xl6UY6OXij/zo N29kCxizu+X8Ls3/XwyI8XmUiFo+hQhIBzt4OAg9YaSuRmbcZWHHgVpEyMKjcBhBC2w== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796040353; h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References: Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=Vmpj+dgt3SgVJ3+YtA1/zdKW3wNLlkWR2+/6TT50Lig=; b=mbSVxP35OXr6x101lV5bBWp8FqirrPa3EamA519tcRco23o1kKzEtveW/9bTj8X3LofL Cyg5Hs0paadPr+PrsDzgXbmq5gwfT2INBCjmHvWua0N7ZuEQAjYFaMXlIgN0tobB/JZ7F ZIcjb3qcDeZORb1P948Z2ia+HfuKPMXES2aderPE+CCHKFlQPqWAM0kOaa+LylIbWAs6p OBfEMMmSj19GAyYFB1eajcj4qF2Tls97KDuU2SKsRvQWPOmr70CccB4fLlksvVlpDMXPx MybwRK0pb7GrD2TgburONCwQtnBwtAWNYbDA8HH6/WGPlB0mCtxkdTfGfAs9KTNiJbA== 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=hnegZSG5; 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 DFA56606A327; Mon, 30 Nov 2026 12:05:52 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7C2D1F00934; Mon, 30 Nov 2026 12:05:51 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796040352; bh=Vmpj+dgt3SgVJ3+YtA1/zdKW3wNLlkWR2+/6TT50Lig=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=hnegZSG5Tv5y8BMQ3Sv6j9Cx2x2v8QUXqQ6qMggaX6QVA9f4t/3ujnjznKi1PZzKq f+PCOc/Fv6n0FLhI8O59qPlfsplRaih78xu4eg+z8JanwGMDEjF6jVQdsZ5jUtFVdU u70Xx3C6+KInd2Ls0PmAMUGXmPws+jL4J3jJL/ZJztx1qWUF3BkzmPnwhiTPhlDbC+ 9wqaz1Lz9bBPzhqDFCoeZF7Ryx64iDhJPNXbDzWilLUymMOHwxWsZbZ5C22ZvVjrhC ymM9hPEDrftiOUgXSlsiHGpLXbisYpnP7/G64QvNw1Qc+wKfO7Mkb1A/rgVgRBrAV/ CH6nr+JESgHMw== X-Cc: Magnus Karlsson <magnus.karlsson@intel.com>, Alexander Lobakin <aleksander.lobakin@intel.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Jesper Dangaard Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Willem de Bruijn <willemb@google.com>, Andrii Nakryiko <andrii@kernel.org>, Eduard Zingerman <eddyz87@gmail.com>, Kumar Kartikeya Dwivedi <memxor@gmail.com>, Shuah Khan <shuah@kernel.org>, netdev@vger.kernel.org, bpf@vger.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>, Tony Nguyen <anthony.l.nguyen@intel.com>, Przemek Kitszel <przemyslaw.kitszel@intel.com>, Larysa Zaremba <larysa.zaremba@intel.com>, Tushar Vyavahare <tushar.vyavahare@intel.com>, Jason Xing <kerneljasonxing@gmail.com>, Bastien Curutchet <bastien.curutchet@bootlin.com>, Colin Ian King <colin.i.king@gmail.com>, intel-wired-lan@lists.osuosl.org, linux-kselftest@vger.kernel.org X-In-Reply-To: <awnZgwW2z3fDj1Jx@boxer> 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