summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/uninit_stack.c
diff options
context:
space:
mode:
authorEduard Zingerman <eddyz87@gmail.com>2023-02-19 21:04:27 +0100
committerAlexei Starovoitov <ast@kernel.org>2023-02-22 21:34:50 +0100
commit6338a94d5ab42a94e96ea36edc5f7df1fe73e68e (patch)
treeeb8bd666efbe96ebae7a891d0b8661dcad7fbbcf /tools/testing/selftests/bpf/prog_tests/uninit_stack.c
parentbpf: Allow reads from uninit stack (diff)
downloadlinux-6338a94d5ab42a94e96ea36edc5f7df1fe73e68e.tar.xz
linux-6338a94d5ab42a94e96ea36edc5f7df1fe73e68e.zip
selftests/bpf: Tests for uninitialized stack reads
Three testcases to make sure that stack reads from uninitialized locations are accepted by verifier when executed in privileged mode: - read from a fixed offset; - read from a variable offset; - passing a pointer to stack to a helper converts STACK_INVALID to STACK_MISC. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20230219200427.606541-3-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/uninit_stack.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/uninit_stack.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/uninit_stack.c b/tools/testing/selftests/bpf/prog_tests/uninit_stack.c
new file mode 100644
index 000000000000..e64c71948491
--- /dev/null
+++ b/tools/testing/selftests/bpf/prog_tests/uninit_stack.c
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <test_progs.h>
+#include "uninit_stack.skel.h"
+
+void test_uninit_stack(void)
+{
+ RUN_TESTS(uninit_stack);
+}