Skip to content

Commit 7f0059b

Browse files
author
Alexei Starovoitov
committed
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 <[email protected]>
1 parent 4e8ca13 commit 7f0059b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/testing/selftests/bpf/progs/kprobe_multi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ __u64 kretprobe_test6_result = 0;
3636
__u64 kretprobe_test7_result = 0;
3737
__u64 kretprobe_test8_result = 0;
3838

39+
extern bool CONFIG_X86_KERNEL_IBT __kconfig __weak;
40+
3941
static void kprobe_multi_check(void *ctx, bool is_return)
4042
{
4143
if (bpf_get_current_pid_tgid() >> 32 != pid)
4244
return;
4345

4446
__u64 cookie = test_cookie ? bpf_get_attach_cookie(ctx) : 0;
45-
__u64 addr = bpf_get_func_ip(ctx);
47+
__u64 addr = bpf_get_func_ip(ctx) - (CONFIG_X86_KERNEL_IBT ? 4 : 0);
4648

4749
#define SET(__var, __addr, __cookie) ({ \
4850
if (((const void *) addr == __addr) && \

0 commit comments

Comments
 (0)