diff options
author | Alexei Starovoitov <ast@kernel.org> | 2022-03-22 07:54:19 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-03-22 21:09:13 +0300 |
commit | 7f0059b58f0257d895fafd2f2e3afe3bbdf21e64 (patch) | |
tree | f3bae93c6282543cd0bb93b0f2a3b003f0c5c196 /tools/testing | |
parent | 4e8ca13440b4b84873da44871f8824a12381d16b (diff) | |
download | linux-7f0059b58f0257d895fafd2f2e3afe3bbdf21e64.tar.xz |
selftests/bpf: Fix kprobe_multi test.
When compiler emits endbr insn the function address could
be different than what bpf_get_func_ip() reports.
This is a short term workaround.
bpf_get_func_ip() will be fixed later.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing')
-rw-r--r-- | tools/testing/selftests/bpf/progs/kprobe_multi.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/progs/kprobe_multi.c b/tools/testing/selftests/bpf/progs/kprobe_multi.c index af27d2c6fce8..600be50800f8 100644 --- a/tools/testing/selftests/bpf/progs/kprobe_multi.c +++ b/tools/testing/selftests/bpf/progs/kprobe_multi.c @@ -36,13 +36,15 @@ __u64 kretprobe_test6_result = 0; __u64 kretprobe_test7_result = 0; __u64 kretprobe_test8_result = 0; +extern bool CONFIG_X86_KERNEL_IBT __kconfig __weak; + static void kprobe_multi_check(void *ctx, bool is_return) { if (bpf_get_current_pid_tgid() >> 32 != pid) return; __u64 cookie = test_cookie ? bpf_get_attach_cookie(ctx) : 0; - __u64 addr = bpf_get_func_ip(ctx); + __u64 addr = bpf_get_func_ip(ctx) - (CONFIG_X86_KERNEL_IBT ? 4 : 0); #define SET(__var, __addr, __cookie) ({ \ if (((const void *) addr == __addr) && \ |