[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <332c50f5-3c68-4fce-8bb3-161f76f2119c@intel.com>
Date: Tue, 28 Jan 2025 16:03:11 +0100
From: Alexander Lobakin <aleksander.lobakin@...el.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>, Saket Kumar Bhaskar
<skb99@...ux.ibm.com>
CC: bpf <bpf@...r.kernel.org>, Network Development <netdev@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@...r.kernel.org>, LKML
<linux-kernel@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>, "Hari
Bathini" <hbathini@...ux.ibm.com>, Andrii Nakryiko <andrii@...nel.org>,
"Daniel Borkmann" <daniel@...earbox.net>, "David S. Miller"
<davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Jesper Dangaard
Brouer <hawk@...nel.org>, Martin KaFai Lau <martin.lau@...ux.dev>, Eddy Z
<eddyz87@...il.com>, "Eric Dumazet" <edumazet@...gle.com>, Paolo Abeni
<pabeni@...hat.com>, Simon Horman <horms@...nel.org>, Song Liu
<song@...nel.org>, Yonghong Song <yonghong.song@...ux.dev>, John Fastabend
<john.fastabend@...il.com>, "KP Singh" <kpsingh@...nel.org>
Subject: Re: [PATCH] bpf: Fix mix-up of 4096 and page size.
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
Date: Thu, 23 Jan 2025 21:14:04 -0800
> On Wed, Jan 22, 2025 at 10:38 AM Saket Kumar Bhaskar
> <skb99@...ux.ibm.com> wrote:
>>
>> For platforms on powerpc architecture with a default page size greater
>> than 4096, there was an inconsistency in fragment size calculation.
>> This caused the BPF selftest xdp_adjust_tail/xdp_adjust_frags_tail_grow
>> to fail on powerpc.
>>
>> The issue occurred because the fragment buffer size in
>> bpf_prog_test_run_xdp() was set to 4096, while the actual data size in
>> the fragment within the shared skb was checked against PAGE_SIZE
>> (65536 on powerpc) in min_t, causing it to exceed 4096 and be set
>> accordingly. This discrepancy led to an overflow when
>> bpf_xdp_frags_increase_tail() checked for tailroom, as skb_frag_size(frag)
>> could be greater than rxq->frag_size (when PAGE_SIZE > 4096).
>>
>> This commit updates the page size references to 4096 to ensure consistency
>> and prevent overflow issues in fragment size calculations.
>
> This isn't right. Please fix the selftest instead.
It's not _that_ easy, I had tried in the past. Anyway, this patch is
*not* a good "solution".
If you (Saket) really want to fix this, both test_run and the selftest
must be in sync, so you need to (both are arch-dependent): 1) get the
correct PAGE_SIZE; 2) calculate the correct tailroom in userspace (which
depends on sizeof(shinfo) and SKB_DATA_ALIGN -> SMP_CACHE_BYTES).
>
> pw-bot: cr
Thanks,
Olek
Powered by blists - more mailing lists