selftests/bpf: make use of PROCMAP_QUERY ioctl if available
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 6 Aug 2024 23:03:19 +0000 (16:03 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 23 Aug 2024 14:46:39 +0000 (07:46 -0700)
commit4e9e07603ecdfd0816838132f354239771c51edd
treefd895cc90186f651678e09f8cdd7e032f11b8633
parentb4406e100347884fb4acaa744bbc01949e74c9f3
selftests/bpf: make use of PROCMAP_QUERY ioctl if available

Instead of parsing text-based /proc/<pid>/maps file, try to use
PROCMAP_QUERY ioctl() to simplify and speed up data fetching.
This logic is used to do uprobe file offset calculation, so any bugs in
this logic would manifest as failing uprobe BPF selftests.

This also serves as a simple demonstration of one of the intended uses.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20240806230319.869734-1-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/test_progs.c
tools/testing/selftests/bpf/test_progs.h
tools/testing/selftests/bpf/trace_helpers.c