Skip to content

Commit 12707b9

Browse files
chengshuyianakryiko
authored andcommitted
libbpf: Fixed getting wrong return address on arm64 architecture
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 <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 8a3f14b commit 12707b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/lib/bpf/bpf_tracing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ struct pt_regs;
522522
#define BPF_KPROBE_READ_RET_IP(ip, ctx) ({ (ip) = (ctx)->link; })
523523
#define BPF_KRETPROBE_READ_RET_IP BPF_KPROBE_READ_RET_IP
524524

525-
#elif defined(bpf_target_sparc)
525+
#elif defined(bpf_target_sparc) || defined(bpf_target_arm64)
526526

527527
#define BPF_KPROBE_READ_RET_IP(ip, ctx) ({ (ip) = PT_REGS_RET(ctx); })
528528
#define BPF_KRETPROBE_READ_RET_IP BPF_KPROBE_READ_RET_IP

0 commit comments

Comments
 (0)