Commit 7f0059b5 authored by Alexei Starovoitov's avatar Alexei Starovoitov

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: default avatarAlexei Starovoitov <ast@kernel.org>
parent 4e8ca134
...@@ -36,13 +36,15 @@ __u64 kretprobe_test6_result = 0; ...@@ -36,13 +36,15 @@ __u64 kretprobe_test6_result = 0;
__u64 kretprobe_test7_result = 0; __u64 kretprobe_test7_result = 0;
__u64 kretprobe_test8_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) static void kprobe_multi_check(void *ctx, bool is_return)
{ {
if (bpf_get_current_pid_tgid() >> 32 != pid) if (bpf_get_current_pid_tgid() >> 32 != pid)
return; return;
__u64 cookie = test_cookie ? bpf_get_attach_cookie(ctx) : 0; __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) ({ \ #define SET(__var, __addr, __cookie) ({ \
if (((const void *) addr == __addr) && \ if (((const void *) addr == __addr) && \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment