Skip to content

Commit 4c82768

Browse files
Yonghong SongMartin KaFai Lau
authored andcommitted
selftests/bpf: Increase xdp data size for arm64 64K page size
With arm64 64K page size, the following 4 subtests failed: #97/25 dynptr/test_probe_read_user_dynptr:FAIL #97/26 dynptr/test_probe_read_kernel_dynptr:FAIL #97/27 dynptr/test_probe_read_user_str_dynptr:FAIL #97/28 dynptr/test_probe_read_kernel_str_dynptr:FAIL These failures are due to function bpf_dynptr_check_off_len() in include/linux/bpf.h where there is a test if (len > size || offset > size - len) return -E2BIG; With 64K page size, the 'offset' is greater than 'size - len', which caused the test failure. For 64KB page size, this patch increased the xdp buffer size from 5000 to 90000. The above 4 test failures are fixed as 'size' value is increased. But it introduced two new failures: #97/4 dynptr/test_dynptr_copy_xdp:FAIL #97/12 dynptr/test_dynptr_memset_xdp_chunks:FAIL These two failures will be addressed in subsequent patches. Signed-off-by: Yonghong Song <[email protected]> Signed-off-by: Martin KaFai Lau <[email protected]> Acked-by: Mykyta Yatsenko <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 95993dc commit 4c82768

File tree

1 file changed

+8
-2
lines changed
  • tools/testing/selftests/bpf/prog_tests

1 file changed

+8
-2
lines changed

tools/testing/selftests/bpf/prog_tests/dynptr.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ static struct {
5151
{"test_copy_from_user_task_str_dynptr", SETUP_SYSCALL_SLEEP},
5252
};
5353

54+
#define PAGE_SIZE_64K 65536
55+
5456
static void verify_success(const char *prog_name, enum test_setup_type setup_type)
5557
{
5658
char user_data[384] = {[0 ... 382] = 'a', '\0'};
@@ -146,14 +148,18 @@ static void verify_success(const char *prog_name, enum test_setup_type setup_typ
146148
}
147149
case SETUP_XDP_PROG:
148150
{
149-
char data[5000];
151+
char data[90000];
150152
int err, prog_fd;
151153
LIBBPF_OPTS(bpf_test_run_opts, opts,
152154
.data_in = &data,
153-
.data_size_in = sizeof(data),
154155
.repeat = 1,
155156
);
156157

158+
if (getpagesize() == PAGE_SIZE_64K)
159+
opts.data_size_in = sizeof(data);
160+
else
161+
opts.data_size_in = 5000;
162+
157163
prog_fd = bpf_program__fd(prog);
158164
err = bpf_prog_test_run_opts(prog_fd, &opts);
159165

0 commit comments

Comments
 (0)