Re: [PATCH] bpf: Fix mix-up of 4096 and page size.

From: Alexei Starovoitov
Date: Fri Jan 24 2025 - 00:14:30 EST


On Wed, Jan 22, 2025 at 10:38 AM Saket Kumar Bhaskar
<skb99@xxxxxxxxxxxxx> 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.

pw-bot: cr