From: sashiko-bot@kernel.org
To: "Jens Remus" <jremus@linux.ibm.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Jiri Kosina" <jikos@kernel.org>,
"Roman Gushchin" <roman.gushchin@linux.dev>,
"Indu Bhagat" <ibhagatgnu@gmail.com>,
"Dylan Hatch" <dylanbhatch@google.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Weinan Liu" <wnliu@google.com>,
"Josh Poimboeuf" <jpoimboe@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Will Deacon" <will@kernel.org>
Cc: "Prasanna Kumar T S M" <ptsm@linux.microsoft.com>,
"Puranjay Mohan" <puranjay@kernel.org>,
joe.lawrence@redhat.com, linux-arm-kernel@lists.infradead.org,
"Randy Dunlap" <rdunlap@infradead.org>,
"Mostafa Saleh" <smostafa@google.com>,
"Song Liu" <song@kernel.org>,
linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
linux-toolchains@vger.kernel.org,
"Herbert Xu" <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH v7 05/11] arm64/module, sframe: Add sframe support for modules
Date: Fri, 18 Sep 2026 22:54:26 +0000 [thread overview]
Message-ID: <20260918225426.8797A1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260918224157.1471085-6-dylanbhatch@google.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] sframe: UAF and lockdep warning due to missing RCU lock around module lookup
- [Medium] sframe: architecture abstraction violation in generic module code
--
commit d8442279cd580755fb98f0f72b910fcd83585a23
Author: Dylan Hatch <dylanbhatch@google.com>
arm64/module, sframe: Add sframe support for modules
This commit adds SFrame support for kernel modules on ARM64 by extending
the architecture-specific module structure. It parses the .sframe section
from incoming modules during load time and registers it for stack unwinding.
> diff --git a/arch/arm64/include/asm/module.h b/arch/arm64/include/asm/module.h
> index fb9b88eebeb15..07f309c51eee6 100644
> --- a/arch/arm64/include/asm/module.h
> +++ b/arch/arm64/include/asm/module.h
[ ... ]
> @@ -17,6 +18,11 @@ struct mod_arch_specific {
> struct mod_plt_sec core;
> struct mod_plt_sec init;
>
> +#ifdef CONFIG_HAVE_UNWIND_KERNEL_SFRAME
> + struct sframe_section sframe_sec;
> + bool sframe_init;
> +#endif
> +
[Severity: Medium]
Will this break cross-architecture builds if other architectures attempt to
adopt SFrame?
By placing these generically named fields into the ARM64-specific
mod_arch_specific struct, generic unwinder code in kernel/unwind/sframe.c
is now tightly coupled to an architecture-private layout.
Should these generic module extensions reside directly in struct module
(in include/linux/module.h) under the appropriate config guards instead?
[ ... ]
> diff --git a/kernel/unwind/sframe.c b/kernel/unwind/sframe.c
> index 9aac703f7ce6e..503d4a2beb50e 100644
> --- a/kernel/unwind/sframe.c
> +++ b/kernel/unwind/sframe.c
[ ... ]
> @@ -405,12 +409,43 @@ static __always_inline int __sframe_find(struct sframe_section *sec,
> return __find_fre(sec, &fde, ip, frame);
> }
>
> +#ifdef CONFIG_MODULES
> +
> +static __always_inline int __sframe_find_module(unsigned long ip,
> + struct unwind_frame *frame)
> +{
> + struct module *mod;
> +
> + mod = __module_text_address(ip);
[Severity: High]
Does this code introduce a use-after-free and a lockdep warning?
Stack unwinding can be initiated from preemptible contexts, but
__module_text_address() requires preemption to be disabled or the RCU read
lock to be held. If a module is concurrently unloaded via sys_delete_module()
immediately after __module_text_address() returns, the returned pointer
becomes dangling.
The subsequent call to __sframe_find() would then dereference pointers within
the freed memory. Should this lookup and data access be wrapped in
guard(rcu)(); or an rcu_read_lock() / rcu_read_unlock() block?
> + if (!mod || !READ_ONCE(mod->arch.sframe_init))
> + return -EINVAL;
> +
> + return __sframe_find(&mod->arch.sframe_sec, ip, frame);
[Severity: Medium]
Does this generic lookup code directly reach into the arch-specific
abstraction? This creates a tight coupling between the generic module unwinder
and the ARM64-specific layout.
[ ... ]
> +void sframe_module_init(struct module *mod, void *sframe, size_t sframe_size)
> +{
> + struct sframe_section *sec = &mod->arch.sframe_sec;
[Severity: Medium]
Is it safe for this generic initialization code to assume the presence of
the sframe_sec field in the architecture-private mod_arch_specific structure?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260918224157.1471085-1-dylanbhatch@google.com?part=5
next prev parent reply other threads:[~2026-09-18 22:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 22:41 [PATCH v7 00/11] unwind, arm64: add sframe unwinder for kernel Dylan Hatch
2026-09-18 22:41 ` [PATCH v7 01/11] arm64, unwind: build kernel with sframe V3 info Dylan Hatch
2026-09-18 22:41 ` [PATCH v7 02/11] arm64/sframe: Read vmlinux .sframe header Dylan Hatch
2026-09-18 22:41 ` [PATCH v7 03/11] sframe: Add support for reading vmlinux .sframe contents Dylan Hatch
2026-09-18 22:41 ` [PATCH v7 04/11] sframe: Separate reading of FRE from reading of FRE data words Dylan Hatch
2026-09-18 22:41 ` [PATCH v7 05/11] arm64/module, sframe: Add sframe support for modules Dylan Hatch
2026-09-18 22:54 ` sashiko-bot [this message]
2026-09-18 22:41 ` [PATCH v7 06/11] arm64/sframe: Validate IP addresses Dylan Hatch
2026-09-18 22:41 ` [PATCH v7 07/11] sframe: Add debug helpers with object name Dylan Hatch
2026-09-18 22:41 ` [PATCH v7 08/11] sframe: Add .sframe validation option Dylan Hatch
2026-09-18 22:41 ` [PATCH v7 09/11] arm64: entry: add unwind info for call_on_irq_stack() Dylan Hatch
2026-09-18 22:41 ` [PATCH v7 10/11] arm64, crypto/lib: Annotate leaf functions with CFI info Dylan Hatch
2026-09-18 22:58 ` sashiko-bot
2026-09-18 22:41 ` [PATCH v7 11/11] unwind: arm64: Use sframe to unwind interrupt frames Dylan Hatch
2026-09-18 23:00 ` sashiko-bot
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=20260918225426.8797A1F000FF@smtp.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®