arm64: stacktrace: WARN_ON(state->common.pc == orig_pc) in kunwind_recover_return_address()

Puranjay Mohan puranjay at kernel.org
Mon Sep 16 03:37:31 PDT 2024


Oleg Nesterov <oleg at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 255 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20240916/d27ffeba/attachment.sig>


More information about the linux-arm-kernel mailing list