Re: [PATCH v5 0/8] unwind, arm64: add sframe unwinder for kernel
Jens Remus <[email protected]> Tue, 19 May 2026 13:05:23 +0200
| Newsgroups | org.kernel.vger.linux-toolchains,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.live-patching |
|---|---|
| Organization | IBM Deutschland Research & Development GmbH |
| Message-ID | <[email protected]> |
Hi Dylan and Mostafa! On 5/18/2026 7:55 PM, Dylan Hatch wrote: > On Fri, May 15, 2026 at 4:32 AM Mostafa Saleh <[email protected]> wrote: >> On Tue, Apr 28, 2026 at 06:36:35PM +0000, Dylan Hatch wrote: >>> 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.0-rc3. This full series (applied to the sframe/core branch) is >>> available on github: [4]. >>> >> >> Not sure if related, but after updating my toolchain >> (aarch64-linux-gnu-gcc (Debian 15.2.0-4) 15.2.0), I hit link errors: >> ld.lld: error: arch/arm64/kernel/vdso/vgettimeofday.o:(.sframe) is being placed in '.sframe' >> ld.lld: error: arch/arm64/kernel/vdso/vgetrandom.o:(.sframe) is being placed in '.sframe` > > Previously when developing against the SFrame V2 format, I had fixed > these warnings with the VDSO Makefile change currently in this series: > > diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile > index 7dec05dd33b7..c60ef921956f 100644 > --- a/arch/arm64/kernel/vdso/Makefile > +++ b/arch/arm64/kernel/vdso/Makefile > @@ -38,7 +38,7 @@ ccflags-y += -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO > CC_FLAGS_REMOVE_VDSO := $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_SCS) \ > $(RANDSTRUCT_CFLAGS) $(KSTACK_ERASE_CFLAGS) \ > $(GCC_PLUGINS_CFLAGS) \ > - $(CC_FLAGS_LTO) $(CC_FLAGS_CFI) \ > + $(CC_FLAGS_LTO) $(CC_FLAGS_CFI) $(CC_FLAGS_SFRAME) \ > -Wmissing-prototypes -Wmissing-declarations > > CC_FLAGS_ADD_VDSO := -O2 -mcmodel=tiny -fasynchronous-unwind-tables > > But the warnings seem to have returned after upgrading my toolchain, > possibly due to SFrame V3 or some confounding change in GCC. The > --gsframe in the assembler should be set to 'no' by default, so > perhaps GCC is providing an override --gsframe internally? Could it be that your build of binutils was configured with --enable-default-sframe, so that the GNU assembler defaults to generate .sframe? AFAIK this configure option was meant for distributors and package maintainers. You can check as follows whether --gsframe defaults to "no" or "yes": $ as --help | grep -A1 gsframe --gsframe[={no|yes}] whether to generate SFrame stack trace information (default: no) ... > >> >> I applied this series hoping that fix it, but it doesn't, so far I >> have this hack : >> diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S >> index 52314be29191..53bdf757ee44 100644 >> --- a/arch/arm64/kernel/vdso/vdso.lds.S >> +++ b/arch/arm64/kernel/vdso/vdso.lds.S >> @@ -77,7 +77,7 @@ SECTIONS >> /DISCARD/ : { >> *(.data .data.* .gnu.linkonce.d.* .sdata*) >> *(.bss .sbss .dynbss .dynsbss) >> - *(.eh_frame .eh_frame_hdr) >> + *(.eh_frame .eh_frame_hdr .sframe) >> } >> } >> >> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h >> index 60c8c22fd3e4..759903acd6fc 100644 >> --- a/include/asm-generic/vmlinux.lds.h >> +++ b/include/asm-generic/vmlinux.lds.h >> @@ -1064,6 +1064,7 @@ >> /* ld.bfd warns about .gnu.version* even when not emitted */ \ >> *(.gnu.version*) \ >> *(__tracepoint_check) \ >> + *(.sframe) \ >> >> #define DISCARDS \ >> /DISCARD/ : { \ > > Since this series only handles kernel stacktrace, I believe it's > better to omit the .sframe section entirely in the case where only > ARCH_SUPPORTS_UNWIND_KERNEL_SFRAME is enabled. I think this hack may > work better for this purpose: > > diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile > index c60ef921956f..29f802bfedb1 100644 > --- a/arch/arm64/kernel/vdso/Makefile > +++ b/arch/arm64/kernel/vdso/Makefile > @@ -41,7 +41,7 @@ CC_FLAGS_REMOVE_VDSO := $(CC_FLAGS_FTRACE) -Os > $(CC_FLAGS_SCS) \ > $(CC_FLAGS_LTO) $(CC_FLAGS_CFI) $(CC_FLAGS_SFRAME) \ > -Wmissing-prototypes -Wmissing-declarations > > -CC_FLAGS_ADD_VDSO := -O2 -mcmodel=tiny -fasynchronous-unwind-tables > +CC_FLAGS_ADD_VDSO := -O2 -mcmodel=tiny -fasynchronous-unwind-tables > -Wa,--gsframe=no > > CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_REMOVE_VDSO) > CFLAGS_REMOVE_vgetrandom.o = $(CC_FLAGS_REMOVE_VDSO) > > Though, I don't understand why it is necessary to provide --gsframe=no > explicitly. If this approach seems ok to other folks/maintainers, I > can fold this into my series. Maybe build the VDSO separately with V=1 to see what assembler/compiler options are effectively used (e.g. for vgettimeofday.o and vgetrandom.o mentioned in the linker error message above)? $ make mrproper $ make defconfig $ ./scripts/config --enable HAVE_UNWIND_KERNEL_SFRAME # enable kernel sframe unwinder $ make arch/arm64/kernel/vdso/ V=1 > > On the topic of SFrame for VDSO, Jens has a patch adding support for > this as part of a series to support userspace SFrame unwinding for > arm64: > > https://lore.kernel.org/lkml/[email protected]/ Any feedback is very welcome. :-) Regards, Jens -- Jens Remus Linux on Z Development (D3303) [email protected] / [email protected] IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294 IBM Data Privacy Statement: https://www.ibm.com/privacy/