[PATCH 0/2] arm64: stacktrace: add kunwind_stack_walk()

Mark Rutland mark.rutland at arm.com
Fri Nov 24 03:05:09 PST 2023


Currently arm64 uses the generic arch_stack_walk() interface for all
stack walking code. This only passes a PC value and cookie to the unwind
callback, whereas we'd like to pass some additional information in some
cases. For example, the BPF exception unwinder wants the FP, for
reliable stacktrace we'll want to perform additional checks on other
portions of unwind state, and we'd like to expand the information
printed by dump_backtrace() to include provenance and reliability
information.

These patches refactor arm64's stacktrace code into a new
kunwind_stack_walk() function that provides the full unwind state to
callback functions. The existing arch_stack_walk() interface is
unchanged, and is implemented atop kunwind_stack_walk().

I had originally intended to send this with additional patches that
would have dump_backtrace() use this to identify and report exception
boundaries and fgraph/kretprobes PC recovery, but due to LPC and bug
hunting over the last few weeks I haven't managed to get all of that
ready just yet.

Puranjay has a need for this for BPF:

  https://lore.kernel.org/linux-arm-kernel/20230917000045.56377-1-puranjay12@gmail.com/

Hence I'm sending this as-is as preparatory rework.

Thanks,
Mark.

Mark Rutland (2):
  arm64: stacktrace: factor out kernel unwind state
  arm64: stacktrace: factor out kunwind_stack_walk()

 arch/arm64/include/asm/stacktrace/common.h |  19 +--
 arch/arm64/include/asm/stacktrace/nvhe.h   |   2 +-
 arch/arm64/kernel/stacktrace.c             | 146 ++++++++++++++-------
 3 files changed, 104 insertions(+), 63 deletions(-)

-- 
2.30.2




More information about the linux-arm-kernel mailing list