[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aRcv4RX40rXKIjxd@willie-the-truck>
Date: Fri, 14 Nov 2025 13:34:25 +0000
From: Will Deacon <will@...nel.org>
To: Dylan Hatch <dylanbhatch@...gle.com>
Cc: Josh Poimboeuf <jpoimboe@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Indu Bhagat <indu.bhagat@...cle.com>,
Peter Zijlstra <peterz@...radead.org>,
Catalin Marinas <catalin.marinas@....com>,
Jiri Kosina <jikos@...nel.org>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Weinan Liu <wnliu@...gle.com>, Mark Rutland <mark.rutland@....com>,
Ian Rogers <irogers@...gle.com>, linux-toolchains@...r.kernel.org,
linux-kernel@...r.kernel.org, live-patching@...r.kernel.org,
joe.lawrence@...hat.com, Puranjay Mohan <puranjay@...nel.org>,
Song Liu <song@...nel.org>,
Prasanna Kumar T S M <ptsm@...ux.microsoft.com>
Subject: Re: [PATCH v2 1/6] unwind: build kernel with sframe info
On Thu, Sep 04, 2025 at 10:38:45PM +0000, Dylan Hatch wrote:
> Use the -Wa,--gsframe flags to build the code, so GAS will generate
> a new .sframe section for the stack trace information.
> Currently, the sframe format only supports arm64 and x86_64
> architectures. Add this configuration on arm64 to enable sframe
> unwinder in the future.
>
> Signed-off-by: Weinan Liu <wnliu@...gle.com>
> Signed-off-by: Dylan Hatch <dylanbhatch@...gle.com>
> Reviewed-by: Prasanna Kumar T S M <ptsm@...ux.microsoft.com>
> ---
> Makefile | 8 ++++++++
> arch/Kconfig | 6 ++++++
> arch/arm64/Kconfig.debug | 10 ++++++++++
> arch/arm64/kernel/vdso/Makefile | 2 +-
> include/asm-generic/vmlinux.lds.h | 15 +++++++++++++++
> 5 files changed, 40 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index b9c661913250..09972c71a3e8 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1078,6 +1078,14 @@ endif
> # Ensure compilers do not transform certain loops into calls to wcslen()
> KBUILD_CFLAGS += -fno-builtin-wcslen
>
> +# build with sframe table
> +ifdef CONFIG_SFRAME_UNWIND_TABLE
> +CC_FLAGS_SFRAME := -Wa,--gsframe
> +KBUILD_CFLAGS += $(CC_FLAGS_SFRAME)
> +KBUILD_AFLAGS += $(CC_FLAGS_SFRAME)
> +export CC_FLAGS_SFRAME
> +endif
> +
> # change __FILE__ to the relative path to the source directory
> ifdef building_out_of_srctree
> KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srcroot)/=)
> diff --git a/arch/Kconfig b/arch/Kconfig
> index d1b4ffd6e085..4362d2f49d91 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -1782,4 +1782,10 @@ config ARCH_WANTS_PRE_LINK_VMLINUX
> config ARCH_HAS_CPU_ATTACK_VECTORS
> bool
>
> +config AS_SFRAME
> + def_bool $(as-instr,.cfi_sections .sframe\n.cfi_startproc\n.cfi_endproc)
Is it possible to extend this check so that we reject assemblers that
emit the unsupported "sframe version one" format?
> +config SFRAME_UNWIND_TABLE
> + bool
Is this extra option actually needed for anything?
> endmenu
> diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug
> index 265c4461031f..d64bf58457de 100644
> --- a/arch/arm64/Kconfig.debug
> +++ b/arch/arm64/Kconfig.debug
> @@ -20,4 +20,14 @@ config ARM64_RELOC_TEST
> depends on m
> tristate "Relocation testing module"
>
> +config SFRAME_UNWINDER
> + bool "Sframe unwinder"
> + depends on AS_SFRAME
> + depends on 64BIT
Shouldn't there be an arch dependency here as well? Since architectures
need to make use of sframe in their unwinders, I was expecting something
like 'depends on ARCH_SUPPORTS_SFRAME_UNWINDER' here.
Will
Powered by blists - more mailing lists