diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2024-08-29 10:42:30 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2024-09-11 09:58:31 -0700 |
commit | 4f4c4fc0153fb11ac40b16c24a24543dc9689d8c (patch) | |
tree | d688b45a81dc448c74453fc2a16eaacf4c5047e1 /kernel/trace | |
parent | cdbb44f9a74fe7d01090ae492672e89cf7d83ce5 (diff) |
bpf: decouple stack_map_get_build_id_offset() from perf_callchain_entry
Change stack_map_get_build_id_offset() which is used to convert stack
trace IP addresses into build ID+offset pairs. Right now this function
accepts an array of u64s as an input, and uses array of
struct bpf_stack_build_id as an output.
This is problematic because u64 array is coming from
perf_callchain_entry, which is (non-sleepable) RCU protected, so once we
allows sleepable build ID fetching, this all breaks down.
But its actually pretty easy to make stack_map_get_build_id_offset()
works with array of struct bpf_stack_build_id as both input and output.
Which is what this patch is doing, eliminating the dependency on
perf_callchain_entry. We require caller to fill out
bpf_stack_build_id.ip fields (all other can be left uninitialized), and
update in place as we do build ID resolution.
We make sure to READ_ONCE() and cache locally current IP value as we
used it in a few places to find matching VMA and so on. Given this data
is directly accessible and modifiable by user's BPF code, we should make
sure to have a consistent view of it.
Reviewed-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20240829174232.3133883-9-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/trace')
0 files changed, 0 insertions, 0 deletions