]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
libbpf: Fixed getting wrong return address on arm64 architecture
authorShuyi Cheng <chengshuyi@linux.alibaba.com>
Sun, 8 Sep 2024 09:23:53 +0000 (17:23 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 9 Sep 2024 22:56:22 +0000 (15:56 -0700)
ARM64 has a separate lr register to store the return address, so here
you only need to read the lr register to get the return address, no need
to dereference it again.

Signed-off-by: Shuyi Cheng <chengshuyi@linux.alibaba.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/1725787433-77262-1-git-send-email-chengshuyi@linux.alibaba.com
tools/lib/bpf/bpf_tracing.h

index 4eab132a963e266e98111788a10c80c0495a0c80..aa3b04f5542a6bbc6bc7c38ebfd1e8b72bdb2b48 100644 (file)
@@ -522,7 +522,7 @@ struct pt_regs;
 #define BPF_KPROBE_READ_RET_IP(ip, ctx)                ({ (ip) = (ctx)->link; })
 #define BPF_KRETPROBE_READ_RET_IP              BPF_KPROBE_READ_RET_IP
 
-#elif defined(bpf_target_sparc)
+#elif defined(bpf_target_sparc) || defined(bpf_target_arm64)
 
 #define BPF_KPROBE_READ_RET_IP(ip, ctx)                ({ (ip) = PT_REGS_RET(ctx); })
 #define BPF_KRETPROBE_READ_RET_IP              BPF_KPROBE_READ_RET_IP