diff options
| author | Kumar Kartikeya Dwivedi <[email protected]> | 2022-03-19 08:08:26 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2022-04-06 17:32:12 +0000 |
| commit | 7cb29b1c99f4244c3f1de04e88eb9aed842a0cba (patch) | |
| tree | b26af2d3fe4d3faddbc6b6d917dd4bda2b25064e /tools/testing/selftests/bpf/prog_tests/test_global_funcs.c | |
| parent | bpf: Reject writes for PTR_TO_MAP_KEY in check_helper_mem_access (diff) | |
| download | kernel-7cb29b1c99f4244c3f1de04e88eb9aed842a0cba.tar.gz kernel-7cb29b1c99f4244c3f1de04e88eb9aed842a0cba.zip | |
selftests/bpf: Test passing rdonly mem to global func
Add two test cases, one pass read only map value pointer to global
func, which should be rejected. The same code checks it for kfunc, so
that is covered as well. Second one tries to use the missing check for
PTR_TO_MEM's MEM_RDONLY flag and tries to write to a read only memory
pointer. Without prior patches, both of these tests fail.
Reviewed-by: Hao Luo <[email protected]>
Signed-off-by: Kumar Kartikeya Dwivedi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/test_global_funcs.c')
| -rw-r--r-- | tools/testing/selftests/bpf/prog_tests/test_global_funcs.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/test_global_funcs.c b/tools/testing/selftests/bpf/prog_tests/test_global_funcs.c index 509e21d5cb9d..b90ee47d3111 100644 --- a/tools/testing/selftests/bpf/prog_tests/test_global_funcs.c +++ b/tools/testing/selftests/bpf/prog_tests/test_global_funcs.c @@ -81,6 +81,7 @@ void test_test_global_funcs(void) { "test_global_func14.o", "reference type('FWD S') size cannot be determined" }, { "test_global_func15.o", "At program exit the register R0 has value" }, { "test_global_func16.o", "invalid indirect read from stack" }, + { "test_global_func17.o", "Caller passes invalid args into func#1" }, }; libbpf_print_fn_t old_print_fn = NULL; int err, i, duration = 0; |
