selftests/bpf: Test bpf_refcount_acquire of node obtained via direct ld
authorDave Marchevsky <davemarchevsky@fb.com>
Tue, 7 Nov 2023 08:56:39 +0000 (00:56 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 10 Nov 2023 03:07:51 +0000 (19:07 -0800)
commite9ed8df7187cfdce1075d0ee591544ac15d072f1
treec234716003d73512a51a9e4e43b0a3cecf0c38ef
parent1b12171533a9bb23cf6fba7262b479028b65e1e8
selftests/bpf: Test bpf_refcount_acquire of node obtained via direct ld

This patch demonstrates that verifier changes earlier in this series
result in bpf_refcount_acquire(mapval->stashed_kptr) passing
verification. The added test additionally validates that stashing a kptr
in mapval and - in a separate BPF program - refcount_acquiring the kptr
without unstashing works as expected at runtime.

Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
Link: https://lore.kernel.org/r/20231107085639.3016113-7-davemarchevsky@fb.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/local_kptr_stash.c
tools/testing/selftests/bpf/progs/local_kptr_stash.c