Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/9] unwind, arm64: add sframe unwinder for kernel
@ 2026-05-19  6:49 Dylan Hatch
  2026-05-19  6:49 ` [PATCH v6 1/9] sframe: Allow kernelspace sframe sections Dylan Hatch
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Dylan Hatch @ 2026-05-19  6:49 UTC (permalink / raw)
  To: Roman Gushchin, Weinan Liu, Will Deacon, Josh Poimboeuf,
	Indu Bhagat, Peter Zijlstra, Steven Rostedt, Catalin Marinas,
	Jiri Kosina, Mark Rutland, Jens Remus
  Cc: Dylan Hatch, Prasanna Kumar T S M, Puranjay Mohan, Song Liu,
	joe.lawrence, linux-toolchains, linux-kernel, live-patching,
	linux-arm-kernel, Randy Dunlap, Mostafa Saleh, Herbert Xu,
	David S. Miller

Implement a generic kernel sframe-based [1] unwinder. The main goal is
to improve reliable stacktrace on arm64 by unwinding across exception
boundaries.

On x86, the ORC unwinder provides reliable stacktrace through similar
methodology, but arm64 lacks the necessary support from objtool to
create ORC unwind tables.

Currently, there's already a sframe unwinder proposed for userspace: [2].
To maintain common definitions and algorithms for sframe lookup, a
substantial portion of this patch series aims to refactor the sframe
lookup code to support both kernel and userspace sframe sections.

Currently, only GNU Binutils support sframe. This series relies on the
Sframe V3 format, which is supported in binutils 2.46.

These patches are based on Steven Rostedt's sframe/core branch [3],
which is and aggregation of existing work done for x86 sframe userspace
unwind, and contains [2]. This branch is, in turn, based on Linux
v7.1-rc2. This full series (applied to the sframe/core branch) is
available on github: [4].

Ref:
[1]: https://sourceware.org/binutils/docs/sframe-spec.html
[2]: https://lore.kernel.org/all/20260505121718.3572346-1-jremus@linux.ibm.com/
[3]: https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git/log/?h=sframe/core
[4]: https://github.com/dylanbhatch/linux/tree/sframe-v6

Changes since v5:
- Rebase on latest sframe/core branch [3] (based on v7.1-rc2).
- (Mark) Drop CFI annotations from el1*_64_* entry functions.
- (Mark) Add CFI annotations for leaf functions in lib/ and crypto/.
- (Jens) Sort module FDEs at load-time, drop linear search method.
- (Jens) Fix mistake in module SFrame validation where temp copy is not
  yet embedded within a struct module.
- (Jens) Initialize debug info for kernel .sframe sections.
- (Mark) Move kernel-specific unwind fields to struct kunwind_state.
- (Mark) Drop SP from unwind state.
- (Mark) Rename unwind_next_frame_sframe -> kunwind_next_regs_sframe,
  add checks to assert a correct KUNWIND_SOURCE_REGS_PC state.
- (Mark) Drop unused flexible FDE handling.
- (Mark) Check CFA alignment to 16 bytes instead of 8 bytes.
- (Mark) For non-KUNWIND_SOURCE_REGS_PC state, drop the fallback to
  SFrame unwind if FP unwind fails in kunwind_next().

Dylan Hatch (8):
  sframe: Allow kernelspace sframe sections
  arm64, unwind: build kernel with sframe V3 info
  arm64, crypto/lib: Annotate leaf functions with CFI info.
  sframe: Provide PC lookup for vmlinux .sframe section
  arm64/module, sframe: Add sframe support for modules
  sframe: Introduce in-kernel SFRAME_VALIDATION
  sframe: Initialize debug info for kernel sections
  unwind: arm64: Use sframe to unwind interrupt frames

Weinan Liu (1):
  arm64: entry: add unwind info for call_on_irq_stack()

 MAINTAINERS                                   |   4 +-
 Makefile                                      |   8 +
 arch/Kconfig                                  |  27 +-
 arch/arm64/Kconfig                            |   1 +
 arch/arm64/crypto/aes-ce-ccm-core.S           |  12 +-
 arch/arm64/crypto/aes-neonbs-core.S           |  40 +-
 arch/arm64/crypto/ghash-ce-core.S             |  20 +-
 arch/arm64/crypto/sm4-ce-ccm-core.S           |  16 +-
 arch/arm64/crypto/sm4-ce-cipher-core.S        |   4 +-
 arch/arm64/crypto/sm4-ce-core.S               |  44 +-
 arch/arm64/crypto/sm4-ce-gcm-core.S           |  16 +-
 arch/arm64/crypto/sm4-neon-core.S             |  12 +-
 arch/arm64/include/asm/linkage.h              |  30 ++
 arch/arm64/include/asm/module.h               |   6 +
 arch/arm64/include/asm/sections.h             |   1 +
 arch/arm64/include/asm/unwind_sframe.h        |  54 +++
 arch/arm64/kernel/entry.S                     |  14 +
 arch/arm64/kernel/module.c                    |   8 +
 arch/arm64/kernel/setup.c                     |   2 +
 arch/arm64/kernel/stacktrace.c                | 222 +++++++++-
 arch/arm64/kernel/vdso/Makefile               |   2 +-
 arch/arm64/kernel/vmlinux.lds.S               |   2 +
 arch/arm64/lib/clear_page.S                   |   4 +-
 arch/arm64/lib/clear_user.S                   |   4 +-
 arch/arm64/lib/copy_from_user.S               |   4 +-
 arch/arm64/lib/copy_page.S                    |   4 +-
 arch/arm64/lib/copy_to_user.S                 |   4 +-
 arch/arm64/lib/memchr.S                       |   4 +-
 arch/arm64/lib/memcmp.S                       |   4 +-
 arch/arm64/lib/memcpy.S                       |   8 +-
 arch/arm64/lib/memset.S                       |   8 +-
 arch/arm64/lib/mte.S                          |  28 +-
 arch/arm64/lib/strchr.S                       |   4 +-
 arch/arm64/lib/strcmp.S                       |   4 +-
 arch/arm64/lib/strlen.S                       |   4 +-
 arch/arm64/lib/strncmp.S                      |   4 +-
 arch/arm64/lib/strnlen.S                      |   4 +-
 arch/arm64/lib/tishift.S                      |  12 +-
 .../{unwind_user_sframe.h => unwind_sframe.h} |   6 +-
 arch/x86/include/asm/unwind_user.h            |  12 +-
 include/asm-generic/sections.h                |   4 +
 include/asm-generic/vmlinux.lds.h             |  15 +
 include/linux/sframe.h                        |  67 ++-
 include/linux/unwind_types.h                  |  46 ++
 include/linux/unwind_user_types.h             |  41 --
 kernel/unwind/Makefile                        |   2 +-
 kernel/unwind/sframe.c                        | 419 ++++++++++++++----
 kernel/unwind/sframe_debug.h                  |  13 +
 kernel/unwind/user.c                          |  45 +-
 49 files changed, 979 insertions(+), 340 deletions(-)
 create mode 100644 arch/arm64/include/asm/unwind_sframe.h
 rename arch/x86/include/asm/{unwind_user_sframe.h => unwind_sframe.h} (50%)
 create mode 100644 include/linux/unwind_types.h

-- 
2.54.0.563.g4f69b47b94-goog



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-05-19 11:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-19  6:49 [PATCH v6 0/9] unwind, arm64: add sframe unwinder for kernel Dylan Hatch
2026-05-19  6:49 ` [PATCH v6 1/9] sframe: Allow kernelspace sframe sections Dylan Hatch
2026-05-19  6:49 ` [PATCH v6 2/9] arm64, unwind: build kernel with sframe V3 info Dylan Hatch
2026-05-19  6:49 ` [PATCH v6 3/9] arm64: entry: add unwind info for call_on_irq_stack() Dylan Hatch
2026-05-19  6:49 ` [PATCH v6 4/9] arm64, crypto/lib: Annotate leaf functions with CFI info Dylan Hatch
2026-05-19  6:49 ` [PATCH v6 5/9] sframe: Provide PC lookup for vmlinux .sframe section Dylan Hatch
2026-05-19  6:49 ` [PATCH v6 6/9] arm64/module, sframe: Add sframe support for modules Dylan Hatch
2026-05-19  6:49 ` [PATCH v6 7/9] sframe: Introduce in-kernel SFRAME_VALIDATION Dylan Hatch
2026-05-19  6:49 ` [PATCH v6 8/9] sframe: Initialize debug info for kernel sections Dylan Hatch
2026-05-19 11:20   ` Jens Remus
2026-05-19  6:49 ` [PATCH v6 9/9] unwind: arm64: Use sframe to unwind interrupt frames Dylan Hatch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox