From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Saket Kumar Bhaskar <skb99@linux.ibm.com>
Cc: bpf <bpf@vger.kernel.org>,
Network Development <netdev@vger.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
"Hari Bathini" <hbathini@linux.ibm.com>,
Andrii Nakryiko <andrii@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eddy Z <eddyz87@gmail.com>, "Eric Dumazet" <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
"KP Singh" <kpsingh@kernel.org>
Subject: Re: [PATCH] bpf: Fix mix-up of 4096 and page size.
Date: Tue, 28 Jan 2025 16:03:11 +0100 [thread overview]
Message-ID: <332c50f5-3c68-4fce-8bb3-161f76f2119c@intel.com> (raw)
In-Reply-To: <CAADnVQJcmyMmxPfSaKgqMiCDZP=Pe8-Jf7NnEdfgxejvZr+44g@mail.gmail.com>
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Date: Thu, 23 Jan 2025 21:14:04 -0800
> On Wed, Jan 22, 2025 at 10:38 AM Saket Kumar Bhaskar
> <skb99@linux.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
next prev parent reply other threads:[~2025-01-28 15:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-22 18:37 [PATCH] bpf: Fix mix-up of 4096 and page size Saket Kumar Bhaskar
2025-01-24 5:14 ` Alexei Starovoitov
2025-01-28 15:03 ` Alexander Lobakin [this message]
2025-02-04 6:57 ` Saket Kumar Bhaskar
2025-02-04 12:45 ` Alexander Lobakin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=332c50f5-3c68-4fce-8bb3-161f76f2119c@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=hbathini@linux.ibm.com \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=skb99@linux.ibm.com \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox