Maciej Fijalkowski <maci…@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 <maci…@intel.com>
>> Fixes: 24ea50127ecf ("xsk: support mbuf on ZC RX")
>> Signed-off-by: Björn Töpel <bjo…@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 <maci…@intel.com>
> Reviewed-by: Maciej Fijalkowski <maci…@intel.com>
Thanks a lot! Sashiko found a few real issues, so v2 changes this
patch...
Björn