]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bpf: Fix an issue in bpf_prog_test_run_xdp when page size greater than 4K
authorYonghong Song <yonghong.song@linux.dev>
Thu, 12 Jun 2025 03:50:32 +0000 (20:50 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 13 Jun 2025 02:07:51 +0000 (19:07 -0700)
commit4fc012daf9c074772421c904357abf586336b1ca
tree0ef2ab80b5295c0398c7cb75f12d1c0f7b6375e4
parentfa6932577c073497379a1f5901ea5b208a38da10
bpf: Fix an issue in bpf_prog_test_run_xdp when page size greater than 4K

The bpf selftest xdp_adjust_tail/xdp_adjust_frags_tail_grow failed on
arm64 with 64KB page:
   xdp_adjust_tail/xdp_adjust_frags_tail_grow:FAIL

In bpf_prog_test_run_xdp(), the xdp->frame_sz is set to 4K, but later on
when constructing frags, with 64K page size, the frag data_len could
be more than 4K. This will cause problems in bpf_xdp_frags_increase_tail().

To fix the failure, the xdp->frame_sz is set to be PAGE_SIZE so kernel
can test different page size properly. With the kernel change, the user
space and bpf prog needs adjustment. Currently, the MAX_SKB_FRAGS default
value is 17, so for 4K page, the maximum packet size will be less than 68K.
To test 64K page, a bigger maximum packet size than 68K is desired. So two
different functions are implemented for subtest xdp_adjust_frags_tail_grow.
Depending on different page size, different data input/output sizes are used
to adapt with different page size.

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20250612035032.2207498-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
net/bpf/test_run.c
tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c
tools/testing/selftests/bpf/progs/test_xdp_adjust_tail_grow.c