Re: [PATCH bpf-next] selftests/bpf: guess function end for test_get_branch_snapshot
From: Andrii Nakryiko <hidden>
Date: 2021-10-26 04:47:02
Also in:
netdev
From: Andrii Nakryiko <hidden>
Date: 2021-10-26 04:47:02
Also in:
netdev
On Fri, Oct 22, 2021 at 4:48 PM Song Liu [off-list ref] wrote:
Function in modules could appear in /proc/kallsyms in random order. ffffffffa02608a0 t bpf_testmod_loop_test ffffffffa02600c0 t __traceiter_bpf_testmod_test_writable_bare ffffffffa0263b60 d __tracepoint_bpf_testmod_test_write_bare ffffffffa02608c0 T bpf_testmod_test_read ffffffffa0260d08 t __SCT__tp_func_bpf_testmod_test_writable_bare ffffffffa0263300 d __SCK__tp_func_bpf_testmod_test_read ffffffffa0260680 T bpf_testmod_test_write ffffffffa0260860 t bpf_testmod_test_mod_kfunc Therefore, we cannot reliably use kallsyms_find_next() to find the end of a function. Replace it with a simple guess (start + 128). This is good enough for this test.
It's so annoying that sizes of all those symbols are known and available in ELF, yet kallsyms don't expose them :( I've applied this "fix", but it makes me very sad.
Signed-off-by: Song Liu <redacted> --- .../bpf/prog_tests/get_branch_snapshot.c | 7 ++-- tools/testing/selftests/bpf/trace_helpers.c | 36 ------------------- tools/testing/selftests/bpf/trace_helpers.h | 5 --- 3 files changed, 4 insertions(+), 44 deletions(-)
[...]