summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/test_ksyms_btf_write_check.c
AgeCommit message (Collapse)AuthorFilesLines
2023-03-10selftests/bpf: fix lots of silly mistakes pointed out by compilerAndrii Nakryiko1-1/+0
Once we enable -Wall for BPF sources, compiler will complain about lots of unused variables, variables that are set but never read, etc. Fix all these issues first before enabling -Wall in Makefile. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20230309054015.4068562-4-andrii@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2022-04-06selftests/bpf: Test passing rdonly mem to global funcKumar Kartikeya Dwivedi1-1/+17
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 <haoluo@google.com> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20220319080827.73251-5-memxor@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2021-12-19bpf/selftests: Test PTR_TO_RDONLY_MEMHao Luo1-0/+29
This test verifies that a ksym of non-struct can not be directly updated. Signed-off-by: Hao Luo <haoluo@google.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20211217003152.48334-10-haoluo@google.com