bpf/selftests: Test for bpf_per_cpu_ptr() and bpf_this_cpu_ptr()
authorHao Luo <haoluo@google.com>
Tue, 29 Sep 2020 23:50:49 +0000 (16:50 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 2 Oct 2020 22:00:49 +0000 (15:00 -0700)
commit00dc73e44a846fc5310df0e1415a90af76cc135e
treee3d0e30829fc1afe77a5a0305216e6ef2b93a381
parent63d9b80dcf2c67bc5ade61cbbaa09d7af21f43f1
bpf/selftests: Test for bpf_per_cpu_ptr() and bpf_this_cpu_ptr()

Test bpf_per_cpu_ptr() and bpf_this_cpu_ptr(). Test two paths in the
kernel. If the base pointer points to a struct, the returned reg is
of type PTR_TO_BTF_ID. Direct pointer dereference can be applied on
the returned variable. If the base pointer isn't a struct, the
returned reg is of type PTR_TO_MEM, which also supports direct pointer
dereference.

Signed-off-by: Hao Luo <haoluo@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200929235049.2533242-7-haoluo@google.com
tools/testing/selftests/bpf/prog_tests/ksyms_btf.c
tools/testing/selftests/bpf/progs/test_ksyms_btf.c