Patch "ARM: clang: Do not rely on lr register for stacktrace" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ARM: clang: Do not rely on lr register for stacktrace

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm-clang-do-not-rely-on-lr-register-for-stacktrace.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 9fcf89f6d5cf3cabd68ceac65fbd1c3801e41b9e
Author: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Date:   Thu Oct 21 09:55:17 2021 +0900

    ARM: clang: Do not rely on lr register for stacktrace
    
    [ Upstream commit b3ea5d56f212ad81328c82454829a736197ebccc ]
    
    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@xxxxxxxxxx>
    Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
index 76ea4178a55cb..db798eac74315 100644
--- a/arch/arm/kernel/stacktrace.c
+++ b/arch/arm/kernel/stacktrace.c
@@ -54,8 +54,7 @@ int notrace unwind_frame(struct stackframe *frame)
 
 	frame->sp = frame->fp;
 	frame->fp = *(unsigned long *)(fp);
-	frame->pc = frame->lr;
-	frame->lr = *(unsigned long *)(fp + 4);
+	frame->pc = *(unsigned long *)(fp + 4);
 #else
 	/* check current frame pointer is within bounds */
 	if (fp < low + 12 || fp > high - 4)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux