Skip to content

Commit b3ea5d5

Browse files
mhiramatrostedt
authored andcommitted
ARM: clang: Do not rely on lr register for stacktrace
Currently the stacktrace on clang compiled arm kernel uses the 'lr' register to find the first frame address from pt_regs. However, that is wrong after calling another function, because the 'lr' register is used by 'bl' instruction and never be recovered. As same as gcc arm kernel, directly use the frame pointer (r11) of the pt_regs to find the first frame address. Note that this fixes kretprobe stacktrace issue only with CONFIG_UNWINDER_FRAME_POINTER=y. For the CONFIG_UNWINDER_ARM, we need another fix. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent cd9bc2c commit b3ea5d5

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎arch/arm/kernel/stacktrace.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ int notrace unwind_frame(struct stackframe *frame)
5454

5555
frame->sp = frame->fp;
5656
frame->fp = *(unsigned long *)(fp);
57-
frame->pc = frame->lr;
58-
frame->lr = *(unsigned long *)(fp + 4);
57+
frame->pc = *(unsigned long *)(fp + 4);
5958
#else
6059
/* check current frame pointer is within bounds */
6160
if (fp < low + 12 || fp > high - 4)

0 commit comments

Comments
 (0)