summaryrefslogtreecommitdiff
path: root/arch/arm/include/asm/stacktrace.h
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2022-01-24 16:49:09 +0100
committerArd Biesheuvel <ardb@kernel.org>2022-02-09 09:13:43 +0100
commit538b9265c063f081ca6b1228d242575a1db60711 (patch)
treebefdd399f7bf56691bf58e7fb09bbd3107cddb46 /arch/arm/include/asm/stacktrace.h
parent953f534a7ed6b725d4f101d2949393acc9262880 (diff)
ARM: unwind: track location of LR value in stack frame
The ftrace graph tracer needs to override the return address of an instrumented function, in order to install a hook that gets invoked when the function returns again. Currently, we only support this when building for ARM using GCC with frame pointers, as in this case, it is guaranteed that the function will reload LR from [FP, #-4] in all cases, and we can simply pass that address to the ftrace code. In order to support this for configurations that rely on the EABI unwinder, such as Thumb2 builds, make the unwinder keep track of the address from which LR was unwound, permitting ftrace to make use of this in a subsequent patch. Drop the call to is_kernel_text_address(), which is problematic in terms of ftrace recursion, given that it may be instrumented itself. The call is redundant anyway, as no unwind directives will be found unless the PC points to memory that is known to contain executable code. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Diffstat (limited to 'arch/arm/include/asm/stacktrace.h')
-rw-r--r--arch/arm/include/asm/stacktrace.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/arm/include/asm/stacktrace.h b/arch/arm/include/asm/stacktrace.h
index d87d60532b86..e56503fd9447 100644
--- a/arch/arm/include/asm/stacktrace.h
+++ b/arch/arm/include/asm/stacktrace.h
@@ -14,6 +14,9 @@ struct stackframe {
unsigned long sp;
unsigned long lr;
unsigned long pc;
+
+ /* address of the LR value on the stack */
+ unsigned long *lr_addr;
#ifdef CONFIG_KRETPROBES
struct llist_node *kr_cur;
struct task_struct *tsk;