]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: Test for writes to map key from BPF helpers
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Sat, 19 Mar 2022 08:08:27 +0000 (13:38 +0530)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 6 Apr 2022 17:32:12 +0000 (10:32 -0700)
commit57f4775cd38020dc3f1dc71d9bf2b71c8e7ab25c
tree7efd30f074b4f459397a3d2625cb129d66ddfca6
parent7bfb97460be9b25c83d5fbdc2c57d2bf3c4c9e3c
selftests/bpf: Test for writes to map key from BPF helpers

When invoking bpf_for_each_map_elem callback, we are passed a
PTR_TO_MAP_KEY, previously writes to this through helper may be allowed,
but the fix in previous patches is meant to prevent that case. The test
case tries to pass it as writable memory to helper, and fails test if it
succeeds to pass the verifier.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20220319080827.73251-6-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/for_each.c
tools/testing/selftests/bpf/progs/for_each_map_elem_write_key.c [new file with mode: 0644]