aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYonghong Song <yonghong.song@linux.dev>2025-07-24 21:34:40 -0700
committerMartin KaFai Lau <martin.lau@kernel.org>2025-07-25 18:20:44 -0700
commit4a5dcb337395db24976090e84f52d48e597697f9 (patch)
treee02fb0445803f3dcb67d59a49a85fe576f640e8d
parentselftests/bpf: Fix test dynptr/test_dynptr_copy_xdp failure (diff)
downloadlinux-4a5dcb337395db24976090e84f52d48e597697f9.tar.gz
linux-4a5dcb337395db24976090e84f52d48e597697f9.zip
selftests/bpf: Fix test dynptr/test_dynptr_memset_xdp_chunks failure
For arm64 64K page size, the xdp data size was set to be more than 64K in one of previous patches. This will cause failure for bpf_dynptr_memset(). Since the failure of bpf_dynptr_memset() is expected with 64K page size, return success. Signed-off-by: Yonghong Song <yonghong.song@linux.dev> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Link: https://patch.msgid.link/20250725043440.209266-1-yonghong.song@linux.dev
-rw-r--r--tools/testing/selftests/bpf/progs/dynptr_success.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/progs/dynptr_success.c b/tools/testing/selftests/bpf/progs/dynptr_success.c
index 3094a1e4ee91..8315273cb900 100644
--- a/tools/testing/selftests/bpf/progs/dynptr_success.c
+++ b/tools/testing/selftests/bpf/progs/dynptr_success.c
@@ -9,6 +9,8 @@
#include "bpf_misc.h"
#include "errno.h"
+#define PAGE_SIZE_64K 65536
+
char _license[] SEC("license") = "GPL";
int pid, err, val;
@@ -821,8 +823,17 @@ int test_dynptr_memset_xdp_chunks(struct xdp_md *xdp)
data_sz = bpf_dynptr_size(&ptr_xdp);
err = bpf_dynptr_memset(&ptr_xdp, 0, data_sz, DYNPTR_MEMSET_VAL);
- if (err)
+ if (err) {
+ /* bpf_dynptr_memset() eventually called bpf_xdp_pointer()
+ * where if data_sz is greater than 0xffff, -EFAULT will be
+ * returned. For 64K page size, data_sz is greater than
+ * 64K, so error is expected and let us zero out error and
+ * return success.
+ */
+ if (data_sz >= PAGE_SIZE_64K)
+ err = 0;
goto out;
+ }
bpf_for(i, 0, max_chunks) {
offset = i * sizeof(buf);