From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>
Subject: [for-next][PATCH 38/40] ARM: clang: Do not rely on lr register for stacktrace
Date: Fri, 22 Oct 2021 16:48:34 -0400 [thread overview]
Message-ID: <20211022204845.186921923@goodmis.org> (raw)
In-Reply-To: 20211022204756.099054287@goodmis.org
From: Masami Hiramatsu <mhiramat@kernel.org>
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>
---
arch/arm/kernel/stacktrace.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
index 76ea4178a55c..db798eac7431 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)
--
2.33.0
next prev parent reply other threads:[~2021-10-22 20:50 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-22 20:47 [for-next][PATCH 00/40] tracing: Updates for 5.16 Steven Rostedt
2021-10-22 20:47 ` [for-next][PATCH 01/40] tracing: Initialize upper and lower vars in pid_list_refill_irq() Steven Rostedt
2021-10-22 20:47 ` [for-next][PATCH 02/40] tracefs: Have tracefs directories not set OTH permission bits by default Steven Rostedt
2021-10-22 20:47 ` [for-next][PATCH 03/40] tracing: Disable "other" permission bits in the tracefs files Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 04/40] ftrace: Cleanup ftrace_dyn_arch_init() Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 05/40] bootconfig: Allocate xbc_data inside xbc_init() Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 06/40] bootconfig: Add xbc_get_info() for the node information Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 07/40] tools/bootconfig: Run test script when build all Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 08/40] bootconfig: Rename xbc_destroy_all() to xbc_exit() Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 09/40] bootconfig: Split parse-tree part from xbc_init Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 10/40] bootconfig: Remove unused debug function Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 11/40] tools/bootconfig: Print all error message in stderr Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 12/40] bootconfig: Replace u16 and u32 with uint16_t and uint32_t Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 13/40] bootconfig: Cleanup dummy headers in tools/bootconfig Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 14/40] ftrace: Add unit test for removing trace function Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 15/40] tracing: in_irq() cleanup Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 16/40] tracing: Use linker magic instead of recasting ftrace_ops_list_func() Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 17/40] tracing/cfi: Fix cmp_entries_* functions signature mismatch Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 18/40] tracing: Reuse logic from perfs get_recursion_context() Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 19/40] tracing/perf: Add interrupt_context_level() helper Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 20/40] x86/ftrace: Remove extra orig rax move Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 21/40] x86/ftrace: Remove fault protection code in prepare_ftrace_return Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 22/40] ftrace/x86_64: Have function graph tracer depend on DYNAMIC_FTRACE Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 23/40] x86/ftrace: Make function graph use ftrace directly Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 24/40] tracing: Add trampoline/graph selftest Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 25/40] tracing: Fix selftest config check for function graph start up test Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 26/40] ftrace: Add ftrace_add_rec_direct function Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 27/40] ftrace: Add multi direct register/unregister interface Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 28/40] ftrace: Add multi direct modify interface Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 29/40] ftrace/samples: Add multi direct interface test module Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 30/40] ftrace/direct: Do not disable when switching direct callers Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 31/40] tracing: Explain the trace recursion transition bit better Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 32/40] tracing: use %ps format string to print symbols Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 33/40] kprobes: convert tests to kunit Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 34/40] x86/unwind: Compile kretprobe fixup code only if CONFIG_KRETPROBES=y Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 35/40] arm64: kprobes: Record frame pointer with kretprobe instance Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 36/40] arm64: kprobes: Make a frame pointer on __kretprobe_trampoline Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 37/40] arm64: Recover kretprobe modified return address in stacktrace Steven Rostedt
2021-10-22 20:48 ` Steven Rostedt [this message]
2021-10-22 20:48 ` [for-next][PATCH 39/40] ARM: kprobes: Make a frame pointer on __kretprobe_trampoline Steven Rostedt
2021-10-22 20:48 ` [for-next][PATCH 40/40] ARM: Recover kretprobe modified return address in stacktrace Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211022204845.186921923@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=ndesaulniers@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.