@@ -10,6 +10,7 @@ extern const void bpf_fentry_test2 __ksym;
extern const void bpf_fentry_test3 __ksym;
extern const void bpf_fentry_test4 __ksym;
extern const void bpf_modify_return_test __ksym;
+extern const void bpf_fentry_test6 __ksym;
__u64 test1_result = 0;
SEC("fentry/bpf_fentry_test1")
@@ -60,3 +61,15 @@ int BPF_PROG(fmod_ret_test, int a, int *b, int ret)
test5_result = (const void *) addr == &bpf_modify_return_test;
return ret;
}
+
+#ifdef __x86_64__
+__u64 test6_result = 0;
+SEC("kprobe/bpf_fentry_test6+0x5")
+int test6(struct pt_regs *ctx)
+{
+ __u64 addr = bpf_get_func_ip(ctx);
+
+ test6_result = (const void *) addr == &bpf_fentry_test6 + 5;
+ return 0;
+}
+#endif
Adding test for bpf_get_func_ip in kprobe+ofset probe. Because of the offset value it's arch specific, adding it only for x86_64 architecture. Signed-off-by: Jiri Olsa <jolsa@kernel.org> --- .../testing/selftests/bpf/progs/get_func_ip_test.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)