* arm64: stacktrace: WARN_ON(state->common.pc == orig_pc) in kunwind_recover_return_address()
@ 2024-09-16 10:27 Oleg Nesterov
2024-09-16 10:37 ` Puranjay Mohan
2024-09-16 10:38 ` Oleg Nesterov
0 siblings, 2 replies; 4+ messages in thread
From: Oleg Nesterov @ 2024-09-16 10:27 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu, Catalin Marinas, Will Deacon,
Puranjay Mohan, Mark Rutland, Mark Brown, Kalesh Singh, chenqiwu
Cc: linux-arm-kernel, linux-kernel
I don't know the details but people report that
kunwind_recover_return_address() hits this warning.
I know absolutely nothing about arm64 or kernel/trace/fgraph.c, but at
first glance this code looks broken:
kunwind_recover_return_address:
...
orig_pc = ftrace_graph_ret_addr(state->task, NULL,
state->common.pc,
(void *)state->common.fp);
if (WARN_ON_ONCE(state->common.pc == orig_pc))
ftrace_graph_ret_addr:
...
if (!idx)
return ret;
given that kunwind_recover_return_address() passes idx == NULL to
ftrace_graph_ret_addr(), it should always return ret == state->common.pc ?
Perhaps this connects to 29c1c24a27 ("function_graph: Fix up ftrace_graph_ret_addr()")
and I have no idea if something like the patch below makes any sense.
Oleg.
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -106,7 +106,8 @@ kunwind_recover_return_address(struct kunwind_state *state)
if (state->task->ret_stack &&
(state->common.pc == (unsigned long)return_to_handler)) {
unsigned long orig_pc;
- orig_pc = ftrace_graph_ret_addr(state->task, NULL,
+ orig_pc = ftrace_graph_ret_addr(state->task,
+ &state->task->curr_ret_stack,
state->common.pc,
(void *)state->common.fp);
if (WARN_ON_ONCE(state->common.pc == orig_pc))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: arm64: stacktrace: WARN_ON(state->common.pc == orig_pc) in kunwind_recover_return_address()
2024-09-16 10:27 arm64: stacktrace: WARN_ON(state->common.pc == orig_pc) in kunwind_recover_return_address() Oleg Nesterov
@ 2024-09-16 10:37 ` Puranjay Mohan
2024-09-16 14:18 ` Oleg Nesterov
2024-09-16 10:38 ` Oleg Nesterov
1 sibling, 1 reply; 4+ messages in thread
From: Puranjay Mohan @ 2024-09-16 10:37 UTC (permalink / raw)
To: Oleg Nesterov, Steven Rostedt, Masami Hiramatsu, Catalin Marinas,
Will Deacon, Mark Rutland, Mark Brown, Kalesh Singh, chenqiwu
Cc: linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1106 bytes --]
Oleg Nesterov <oleg@redhat.com> writes:
> I don't know the details but people report that
> kunwind_recover_return_address() hits this warning.
>
> I know absolutely nothing about arm64 or kernel/trace/fgraph.c, but at
> first glance this code looks broken:
>
> kunwind_recover_return_address:
>
> ...
>
> orig_pc = ftrace_graph_ret_addr(state->task, NULL,
> state->common.pc,
> (void *)state->common.fp);
> if (WARN_ON_ONCE(state->common.pc == orig_pc))
>
> ftrace_graph_ret_addr:
>
> ...
>
> if (!idx)
> return ret;
>
>
> given that kunwind_recover_return_address() passes idx == NULL to
> ftrace_graph_ret_addr(), it should always return ret == state->common.pc ?
>
>
> Perhaps this connects to 29c1c24a27 ("function_graph: Fix up ftrace_graph_ret_addr()")
> and I have no idea if something like the patch below makes any sense.
>
Your finding is accurate.
It has been fixed in upstream by c060f93253ca ("arm64: stacktrace: fix
the usage of ftrace_graph_ret_addr()")
See: https://elixir.bootlin.com/linux/v6.11/source/arch/arm64/kernel/stacktrace.c#L111
Thanks,
Puranjay
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: arm64: stacktrace: WARN_ON(state->common.pc == orig_pc) in kunwind_recover_return_address()
2024-09-16 10:27 arm64: stacktrace: WARN_ON(state->common.pc == orig_pc) in kunwind_recover_return_address() Oleg Nesterov
2024-09-16 10:37 ` Puranjay Mohan
@ 2024-09-16 10:38 ` Oleg Nesterov
1 sibling, 0 replies; 4+ messages in thread
From: Oleg Nesterov @ 2024-09-16 10:38 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu, Catalin Marinas, Will Deacon,
Puranjay Mohan, Mark Rutland, Mark Brown, Kalesh Singh, chenqiwu
Cc: linux-arm-kernel, linux-kernel
Ah, sorry for the noise, I looked into the wrong tree, missed the recent
c060f93253ca ("arm64: stacktrace: fix the usage of ftrace_graph_ret_addr()")
On 09/16, Oleg Nesterov wrote:
>
> I don't know the details but people report that
> kunwind_recover_return_address() hits this warning.
>
> I know absolutely nothing about arm64 or kernel/trace/fgraph.c, but at
> first glance this code looks broken:
>
> kunwind_recover_return_address:
>
> ...
>
> orig_pc = ftrace_graph_ret_addr(state->task, NULL,
> state->common.pc,
> (void *)state->common.fp);
> if (WARN_ON_ONCE(state->common.pc == orig_pc))
>
> ftrace_graph_ret_addr:
>
> ...
>
> if (!idx)
> return ret;
>
>
> given that kunwind_recover_return_address() passes idx == NULL to
> ftrace_graph_ret_addr(), it should always return ret == state->common.pc ?
>
>
> Perhaps this connects to 29c1c24a27 ("function_graph: Fix up ftrace_graph_ret_addr()")
> and I have no idea if something like the patch below makes any sense.
>
> Oleg.
>
> --- a/arch/arm64/kernel/stacktrace.c
> +++ b/arch/arm64/kernel/stacktrace.c
> @@ -106,7 +106,8 @@ kunwind_recover_return_address(struct kunwind_state *state)
> if (state->task->ret_stack &&
> (state->common.pc == (unsigned long)return_to_handler)) {
> unsigned long orig_pc;
> - orig_pc = ftrace_graph_ret_addr(state->task, NULL,
> + orig_pc = ftrace_graph_ret_addr(state->task,
> + &state->task->curr_ret_stack,
> state->common.pc,
> (void *)state->common.fp);
> if (WARN_ON_ONCE(state->common.pc == orig_pc))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: arm64: stacktrace: WARN_ON(state->common.pc == orig_pc) in kunwind_recover_return_address()
2024-09-16 10:37 ` Puranjay Mohan
@ 2024-09-16 14:18 ` Oleg Nesterov
0 siblings, 0 replies; 4+ messages in thread
From: Oleg Nesterov @ 2024-09-16 14:18 UTC (permalink / raw)
To: Puranjay Mohan
Cc: Steven Rostedt, Masami Hiramatsu, Catalin Marinas, Will Deacon,
Mark Rutland, Mark Brown, Kalesh Singh, chenqiwu,
linux-arm-kernel, linux-kernel
On 09/16, Puranjay Mohan wrote:
>
> Oleg Nesterov <oleg@redhat.com> writes:
>
> > given that kunwind_recover_return_address() passes idx == NULL to
> > ftrace_graph_ret_addr(), it should always return ret == state->common.pc ?
> >
> >
> > Perhaps this connects to 29c1c24a27 ("function_graph: Fix up ftrace_graph_ret_addr()")
> > and I have no idea if something like the patch below makes any sense.
> >
>
> Your finding is accurate.
>
> It has been fixed in upstream by c060f93253ca ("arm64: stacktrace: fix
> the usage of ftrace_graph_ret_addr()")
Yes, I have already found that commit, see my next email ;)
Nevertheless, thanks a lot Puranjay for the confirmation!
Oleg.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-16 14:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-16 10:27 arm64: stacktrace: WARN_ON(state->common.pc == orig_pc) in kunwind_recover_return_address() Oleg Nesterov
2024-09-16 10:37 ` Puranjay Mohan
2024-09-16 14:18 ` Oleg Nesterov
2024-09-16 10:38 ` Oleg Nesterov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).