]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: Add test for prealloc_lru_pop bug
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Tue, 9 Aug 2022 21:30:33 +0000 (23:30 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 10 Aug 2022 01:46:11 +0000 (18:46 -0700)
commitb0011657b82954aa162fcff9122f01306370190c
tree8b2a5de71b7b3f5cdbc9972a27724030ea1010d2
parent6ee5134b837aed01e94ba6a764203a32b5b6059b
selftests/bpf: Add test for prealloc_lru_pop bug

Add a regression test to check against invalid check_and_init_map_value
call inside prealloc_lru_pop.

The kptr should not be reset to NULL once we set it after deleting the
map element. Hence, we trigger a program that updates the element
causing its reuse, and checks whether the unref kptr is reset or not.
If it is, prealloc_lru_pop does an incorrect check_and_init_map_value
call and the test fails.

Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20220809213033.24147-4-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/lru_bug.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/lru_bug.c [new file with mode: 0644]