diff options
| author | Dave Marchevsky <[email protected]> | 2023-02-14 00:40:16 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2023-02-14 03:40:53 +0000 |
| commit | 215249f6adc0359e3546829e7ee622b5e309b0ad (patch) | |
| tree | 300b11a30ed51090ee2d0f05841567556ff2e4d4 /tools/testing/selftests/bpf/prog_tests/recursion.c | |
| parent | bpf: Add bpf_rbtree_{add,remove,first} decls to bpf_experimental.h (diff) | |
| download | kernel-215249f6adc0359e3546829e7ee622b5e309b0ad.tar.gz kernel-215249f6adc0359e3546829e7ee622b5e309b0ad.zip | |
selftests/bpf: Add rbtree selftests
This patch adds selftests exercising the logic changed/added in the
previous patches in the series. A variety of successful and unsuccessful
rbtree usages are validated:
Success:
* Add some nodes, let map_value bpf_rbtree_root destructor clean them
up
* Add some nodes, remove one using the non-owning ref leftover by
successful rbtree_add() call
* Add some nodes, remove one using the non-owning ref returned by
rbtree_first() call
Failure:
* BTF where bpf_rb_root owns bpf_list_node should fail to load
* BTF where node of type X is added to tree containing nodes of type Y
should fail to load
* No calling rbtree api functions in 'less' callback for rbtree_add
* No releasing lock in 'less' callback for rbtree_add
* No removing a node which hasn't been added to any tree
* No adding a node which has already been added to a tree
* No escaping of non-owning references past their lock's
critical section
* No escaping of non-owning references past other invalidation points
(rbtree_remove)
These tests mostly focus on rbtree-specific additions, but some of the
failure cases revalidate scenarios common to both linked_list and rbtree
which are covered in the former's tests. Better to be a bit redundant in
case linked_list and rbtree semantics deviate over time.
Signed-off-by: Dave Marchevsky <[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/recursion.c')
0 files changed, 0 insertions, 0 deletions
