aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/bpf_iter_test_kern1.c
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2020-05-09 10:59:23 -0700
committerAlexei Starovoitov <ast@kernel.org>2020-05-09 17:05:27 -0700
commit6879c042e10584ea9d5e2204939cafadcd500465 (patch)
tree4491e7c009f30efcb70b55948767df86a1f8ce70 /tools/testing/selftests/bpf/progs/bpf_iter_test_kern1.c
parenttools/bpf: selftests: Add iter progs for bpf_map/task/task_file (diff)
downloadlinux-6879c042e10584ea9d5e2204939cafadcd500465.tar.gz
linux-6879c042e10584ea9d5e2204939cafadcd500465.zip
tools/bpf: selftests: Add bpf_iter selftests
The added test includes the following subtests: - test verifier change for btf_id_or_null - test load/create_iter/read for ipv6_route/netlink/bpf_map/task/task_file - test anon bpf iterator - test anon bpf iterator reading one char at a time - test file bpf iterator - test overflow (single bpf program output not overflow) - test overflow (single bpf program output overflows) - test bpf prog returning 1 The ipv6_route tests the following verifier change - access fields in the variable length array of the structure. The netlink load tests the following verifier change - put a btf_id ptr value in a stack and accessible to tracing/iter programs. The anon bpf iterator also tests link auto attach through skeleton. $ test_progs -n 2 #2/1 btf_id_or_null:OK #2/2 ipv6_route:OK #2/3 netlink:OK #2/4 bpf_map:OK #2/5 task:OK #2/6 task_file:OK #2/7 anon:OK #2/8 anon-read-one-char:OK #2/9 file:OK #2/10 overflow:OK #2/11 overflow-e2big:OK #2/12 prog-ret-1:OK #2 bpf_iter:OK Summary: 1/12 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/20200509175923.2477637-1-yhs@fb.com
Diffstat (limited to 'tools/testing/selftests/bpf/progs/bpf_iter_test_kern1.c')
-rw-r--r--tools/testing/selftests/bpf/progs/bpf_iter_test_kern1.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_test_kern1.c b/tools/testing/selftests/bpf/progs/bpf_iter_test_kern1.c
new file mode 100644
index 000000000000..c71a7c283108
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/bpf_iter_test_kern1.c
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2020 Facebook */
+#define START_CHAR 'a'
+#include "bpf_iter_test_kern_common.h"