selftests/bpf: Add tests for rbtree API interaction in sleepable progs
authorDave Marchevsky <davemarchevsky@fb.com>
Mon, 21 Aug 2023 19:33:11 +0000 (12:33 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 25 Aug 2023 16:23:17 +0000 (09:23 -0700)
commit312aa5bde8985dd2aef99d3e20abc0889c6f2a3e
treee4fd1a875d7929f9195b30285b00640c523c4bae
parent5861d1e8dbc4e1a03ebffb96ac041026cdd34c07
selftests/bpf: Add tests for rbtree API interaction in sleepable progs

Confirm that the following sleepable prog states fail verification:
  * bpf_rcu_read_unlock before bpf_spin_unlock
     * RCU CS will last at least as long as spin_lock CS

Also confirm that correct usage passes verification, specifically:
  * Explicit use of bpf_rcu_read_{lock, unlock} in sleepable test prog
  * Implied RCU CS due to spin_lock CS

None of the selftest progs actually attach to bpf_testmod's
bpf_testmod_test_read.

Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
Link: https://lore.kernel.org/r/20230821193311.3290257-8-davemarchevsky@fb.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/refcounted_kptr.c
tools/testing/selftests/bpf/progs/refcounted_kptr_fail.c