lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4f350869-acd9-4e2b-a3e0-b3f29a7fbbfb@nvidia.com>
Date: Wed, 23 Jul 2025 09:17:44 +0300
From: Gal Pressman <gal@...dia.com>
To: Paolo Abeni <pabeni@...hat.com>, Jakub Kicinski <kuba@...nel.org>,
 Nimrod Oren <noren@...dia.com>
Cc: Mohsin Bashir <mohsin.bashr@...il.com>, netdev@...r.kernel.org,
 andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
 shuah@...nel.org, horms@...nel.org, cratiu@...dia.com, cjubran@...dia.com,
 mbloch@...dia.com, jdamato@...tly.com, sdf@...ichev.me, ast@...nel.org,
 daniel@...earbox.net, hawk@...nel.org, john.fastabend@...il.com,
 nathan@...nel.org, nick.desaulniers+lkml@...il.com, morbo@...gle.com,
 justinstitt@...gle.com, bpf@...r.kernel.org,
 linux-kselftest@...r.kernel.org, llvm@...ts.linux.dev, tariqt@...dia.com,
 thoiland@...hat.com
Subject: Re: [PATCH net-next V6 2/5] selftests: drv-net: Test XDP_PASS/DROP
 support

On 22/07/2025 18:03, Paolo Abeni wrote:
> On 7/21/25 8:34 PM, Gal Pressman wrote:
>> On 21/07/2025 18:40, Jakub Kicinski wrote:
>>> On Mon, 21 Jul 2025 14:43:15 +0300 Nimrod Oren wrote:
>>>>> +static struct udphdr *filter_udphdr(struct xdp_md *ctx, __u16 port)
>>>>> +{
>>>>> +	void *data_end = (void *)(long)ctx->data_end;
>>>>> +	void *data = (void *)(long)ctx->data;
>>>>> +	struct udphdr *udph = NULL;
>>>>> +	struct ethhdr *eth = data;
>>>>> +
>>>>> +	if (data + sizeof(*eth) > data_end)
>>>>> +		return NULL;
>>>>> +  
>>>>
>>>> This check assumes that the packet headers reside in the linear part of
>>>> the xdp_buff. However, this assumption does not hold across all drivers.
>>>> For example, in mlx5, the linear part is empty when using multi-buffer
>>>> mode with striding rq configuration. This causes all multi-buffer test
>>>> cases to fail over mlx5.
>>>>
>>>> To ensure correctness across all drivers, all direct accesses to packet
>>>> data should use these safer helper functions instead:
>>>> bpf_xdp_load_bytes() and bpf_xdp_store_bytes().
>>>>
>>>> Related discussion and context can be found here:
>>>> https://github.com/xdp-project/xdp-tools/pull/409
>>>
>>> That's a reasonable way to modify the test. But I'm not sure it's
>>> something that should be blocking merging the patches.
>>> Or for that matter whether it's Mohsin's responsibility to make the
>>> test cater to quirks of mlx5, 
>>
>> Definitely not a quirk, you cannot assume the headers are in the linear
>> part, especially if you're going to put this program as reference in the
>> kernel tree.
>>
>> This issue has nothing to do with mlx5, but a buggy XDP program.
> 
> Note that with the self-tests we have a slightly different premise WRT
> the actual kernel code. We prefer on-boarding tests cases that work for
> some/most of the possible setup vs perfect ones, and eventually improve
> incrementally as needed: the goal is to increase the code coverage _and_
> encourage people to contribute new tests upstream.

The changes required to fix the test are trivial, and Nimrod provided a
reference for the conversion.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ