On Fri, Mar 19, 2021 at 07:02:06PM +0000, Catalin Marinas wrote: > On Fri, Mar 19, 2021 at 06:41:06PM +0000, Mark Rutland wrote: > > We recently converted arm64 to use arch_stack_walk() in commit: > > > > 5fc57df2f6fd ("arm64: stacktrace: Convert to ARCH_STACKWALK") > > > > The core stacktrace code expects that (when tracing the current task) > > arch_stack_walk() starts a trace at its caller, and does not include > > itself in the trace. However, arm64's arch_stack_walk() includes itself, > > and so traces include one more entry than callers expect. The core > > stacktrace code which calls arch_stack_walk() tries to skip a number of > > entries to prevent itself appearing in a trace, and the additional entry > > prevents skipping one of the core stacktrace functions, leaving this in > > the trace unexpectedly. > > > > We can fix this by having arm64's arch_stack_walk() begin the trace with > > its caller. The first value returned by the trace will be > > __builtin_return_address(0), i.e. the caller of arch_stack_walk(). The > > first frame record to be unwound will be __builtin_frame_address(1), > > i.e. the caller's frame record. To prevent surprises, arch_stack_walk() > > is also marked noinline.
[...] > > Fixes: 5fc57df2f6fd ("arm64: stacktrace: Convert to ARCH_STACKWALK") > > Signed-off-by: Mark Rutland <mark.rutl...@arm.com> > > Cc: Catalin Marinas <catalin.mari...@arm.com> > > Cc: Chen Jun <chenjun...@huawei.com> > > Cc: Marco Elver <el...@google.com> > > Cc: Mark Brown <broo...@kernel.org> > > Cc: Will Deacon <w...@kernel.org> > > Thanks Mark. I think we should add a cc stable, just with Fixes doesn't > always seem to end up in a stable kernel: > > Cc: <sta...@vger.kernel.org> # 5.10.x Makes sense to me, sure. > With that: > > Reviewed-by: Catalin Marinas <catalin.mari...@arm.com> Thanks! Will, I assume you're happy to fold in the above when picking this. If you'd prefer I repost with that folded in, please let me know! Mark.