mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Roman Gushchin" <roman.gushchin@linux.dev>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Dylan Hatch" <dylanbhatch@google.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Josh Poimboeuf" <jpoimboe@kernel.org>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Jens Remus" <jremus@linux.ibm.com>,
	"Indu Bhagat" <ibhagatgnu@gmail.com>,
	"Will Deacon" <will@kernel.org>, "Jiri Kosina" <jikos@kernel.org>,
	"Weinan Liu" <wnliu@google.com>,
	"Mark Rutland" <mark.rutland@arm.com>
Cc: linux-kernel@vger.kernel.org, linux-toolchains@vger.kernel.org,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"Prasanna Kumar T S M" <ptsm@linux.microsoft.com>,
	joe.lawrence@redhat.com, live-patching@vger.kernel.org,
	"Song Liu" <song@kernel.org>,
	"Puranjay Mohan" <puranjay@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Mostafa Saleh" <smostafa@google.com>
Subject: Re: [PATCH v8 01/11] arm64, unwind: build kernel with sframe V3 info
Date: Wed, 07 Oct 2026 11:56:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-162957@kernel.org> (raw)
In-Reply-To: <20261007114335.440322-2-dylanbhatch@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] unwind: missing SFrame unwind information for Rust code
--

commit 531ea7668c66f4aab865a6399bb07911c3617223
Author: Dylan Hatch <dylanbhatch@google.com>

arm64, unwind: build kernel with sframe V3 info

To generate a .sframe section, build with -Wa,--gsframe-3 flags. Also,
add unwind-table options to ensure the necessary CFI directives are
emitted by the compiler, but discard .eh_frame unless
CONFIG_UNWIND_TABLES is explicitly enabled.

> diff --git a/Makefile b/Makefile
> index 7c855e6fe5448..5c2ca98a86786 100644
> --- a/Makefile
> +++ b/Makefile
[ ... ]
> @@ -1197,6 +1197,14 @@ CFLAGS_GCOV	+= $(call try-run,\
>  endif
>  export CFLAGS_GCOV
>  
> +# build with sframe table
> +ifdef CONFIG_HAVE_UNWIND_KERNEL_SFRAME
> +CC_FLAGS_SFRAME := -Wa,--gsframe-3
> +KBUILD_CFLAGS	+= $(CC_FLAGS_SFRAME)
> +KBUILD_AFLAGS	+= $(CC_FLAGS_SFRAME)

[Severity: Medium]
When CONFIG_HAVE_UNWIND_KERNEL_SFRAME is enabled, the generation flag is
added to C and ASM flags in Makefile, but no equivalent flag is passed to
the Rust compiler.

Because rustc emits object files directly using its LLVM backend and
currently lacks native SFrame emission, does it generate standard .eh_frame
data instead of .sframe?

> +export CC_FLAGS_SFRAME
> +endif
> +
>  # change __FILE__ to the relative path to the source directory
>  ifdef building_out_of_srctree
[ ... ]
> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index 6b005c8fef706..ae1c23579ad2f 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
[ ... ]
> @@ -55,7 +55,7 @@ KBUILD_CFLAGS	+= $(call cc-option,-mabi=lp64)
>  KBUILD_AFLAGS	+= $(call cc-option,-mabi=lp64)
>  
>  # Avoid generating .eh_frame* sections.
> -ifneq ($(CONFIG_UNWIND_TABLES),y)
> +ifeq ($(filter y, $(CONFIG_UNWIND_TABLES) $(CONFIG_HAVE_UNWIND_KERNEL_SFRAME)),)
>  KBUILD_CFLAGS	+= -fno-asynchronous-unwind-tables -fno-unwind-tables
>  KBUILD_AFLAGS	+= -fno-asynchronous-unwind-tables -fno-unwind-tables
>  KBUILD_RUSTFLAGS += -Cforce-unwind-tables=n

[Severity: Medium]
In arch/arm64/Makefile, this change ensures that Rust continues generating
unwind tables when SFrame is enabled. Does this mean Rust will continue to
generate DWARF unwind tables since -Cforce-unwind-tables=n is not applied
when CONFIG_HAVE_UNWIND_KERNEL_SFRAME is enabled and CONFIG_UNWIND_TABLES
is disabled?

[ ... ]
> diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
> index af1d720209764..eb1f54829503c 100644
> --- a/arch/arm64/kernel/vmlinux.lds.S
> +++ b/arch/arm64/kernel/vmlinux.lds.S
[ ... ]
> @@ -145,14 +145,25 @@ jiffies = jiffies_64;
>  #endif
>  
>  #ifdef CONFIG_UNWIND_TABLES
> +
>  #define UNWIND_DATA_SECTIONS				\
>  	.eh_frame : {					\
>  		__pi___eh_frame_start = .;		\
>  		*(.eh_frame)				\
>  		__pi___eh_frame_end = .;		\
>  	}
> +#define SFRAME_DISCARDS
> +
> +#elif defined(CONFIG_HAVE_UNWIND_KERNEL_SFRAME)
> +
> +#define UNWIND_DATA_SECTIONS
> +#define SFRAME_DISCARDS *(.eh_frame)

[Severity: Medium]
When only CONFIG_HAVE_UNWIND_KERNEL_SFRAME is enabled and
CONFIG_UNWIND_TABLES is disabled, the .eh_frame sections are explicitly
discarded here in arch/arm64/kernel/vmlinux.lds.S.

Since Rust code emits .eh_frame data instead of .sframe, does discarding
these sections silently leave all compiled Rust objects without any unwind
information? Could this break reliable stack unwinding across Rust frames?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261007114335.440322-1-dylanbhatch@google.com?part=1

  reply	other threads:[~2026-10-07 11:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07 11:43 [PATCH v8 00/11] unwind, arm64: add sframe unwinder for kernel Dylan Hatch
2026-10-07 11:43 ` [PATCH v8 01/11] arm64, unwind: build kernel with sframe V3 info Dylan Hatch
2026-10-07 11:56   ` sashiko-bot [this message]
2026-10-07 11:43 ` [PATCH v8 02/11] arm64/sframe: Read vmlinux .sframe header Dylan Hatch
2026-10-07 11:43 ` [PATCH v8 03/11] sframe: Add support for reading vmlinux .sframe contents Dylan Hatch
2026-10-07 11:43 ` [PATCH v8 04/11] sframe: Separate reading of FRE from reading of FRE data words Dylan Hatch
2026-10-07 11:43 ` [PATCH v8 05/11] module, sframe: Add sframe support for modules Dylan Hatch
2026-10-07 12:09   ` sashiko-bot
2026-10-07 11:43 ` [PATCH v8 06/11] arm64/sframe: Validate IP addresses Dylan Hatch
2026-10-07 12:14   ` sashiko-bot
2026-10-07 11:43 ` [PATCH v8 07/11] sframe: Add debug helpers with object name Dylan Hatch
2026-10-07 12:09   ` sashiko-bot
2026-10-07 11:43 ` [PATCH v8 08/11] sframe: Add .sframe validation option Dylan Hatch
2026-10-07 11:43 ` [PATCH v8 09/11] arm64: entry: add unwind info for call_on_irq_stack() Dylan Hatch
2026-10-07 11:43 ` [PATCH v8 10/11] arm64, crypto/lib: Annotate leaf functions with CFI info Dylan Hatch
2026-10-07 11:43 ` [PATCH v8 11/11] unwind: arm64: Use sframe to unwind interrupt frames Dylan Hatch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-162957@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=davem@davemloft.net \
    --cc=dylanbhatch@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=ibhagatgnu@gmail.com \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@kernel.org \
    --cc=jremus@linux.ibm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=peterz@infradead.org \
    --cc=ptsm@linux.microsoft.com \
    --cc=puranjay@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=roman.gushchin@linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=smostafa@google.com \
    --cc=song@kernel.org \
    --cc=will@kernel.org \
    --cc=wnliu@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®