From: Breno Leitao <leitao@debian.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
usamaarif642@gmail.com, rmikey@meta.com, andreyknvl@gmail.com,
kasan-dev@googlegroups.com, linux-efi@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH] arm64: efi: Fix KASAN false positive for EFI runtime stack
Date: Fri, 4 Jul 2025 13:36:40 +0100 [thread overview]
Message-ID: <aGfK2N6po39zyVIp@gmail.com> (raw)
In-Reply-To: <CAMj1kXFadibWLnhFv3cOk-7Ah2MmPz8RqDuQjGr-3gmq+hEnMg@mail.gmail.com>
Hello Ard,
On Fri, Jul 04, 2025 at 10:26:37AM +0200, Ard Biesheuvel wrote:
> On Thu, 3 Jul 2025 at 18:35, Catalin Marinas <catalin.marinas@arm.com> wrote:
> > On Tue, Jun 24, 2025 at 05:55:53AM -0700, Breno Leitao wrote:
...
> > > arch/arm64/kernel/efi.c | 9 ++++++---
...
> > > static bool region_is_misaligned(const efi_memory_desc_t *md)
> > > {
> > > @@ -214,9 +215,11 @@ static int __init arm64_efi_rt_init(void)
> > > if (!efi_enabled(EFI_RUNTIME_SERVICES))
> > > return 0;
> > >
> > > - p = __vmalloc_node(THREAD_SIZE, THREAD_ALIGN, GFP_KERNEL,
> > > - NUMA_NO_NODE, &&l);
> > > -l: if (!p) {
> > > + if (!IS_ENABLED(CONFIG_VMAP_STACK))
> > > + return -ENOMEM;
> >
> > Mark Rutland pointed out in a private chat that this should probably
> > clear the EFI_RUNTIME_SERVICES flag as well.
> >
>
> If VMAP_STACK is a hard requirement, should we make CONFIG_EFI depend
> on it for arm64?
What about if we make CONFIG_EFI select VMAP_STACK? I think it is more
straight forward from a configuration perspective.
I thought about the following. What do you think?
arm64: EFI selects VMAP_STACK
Modify the ARM64 Kconfig to make the CONFIG_EFI configuration option
automatically select CONFIG_VMAP_STACK.
The motivation is that arm64_efi_rt_init() will fail at runtime if
CONFIG_VMAP_STACK is not set, so the patch ensures that enabling EFI
will always enable VMAP_STACK as well, and avoid having EFI disabled in
case the user didn't set VMAP_STACK.
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Breno Leitao <leitao@debian.org>
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 55fc331af3371..cc2585143f511 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -2437,6 +2437,7 @@ config EFI
select EFI_RUNTIME_WRAPPERS
select EFI_STUB
select EFI_GENERIC_STUB
+ select VMAP_STACK
imply IMA_SECURE_AND_OR_TRUSTED_BOOT
default y
help
> > (but let's see if Ard has a different opinion on the approach)
> I think this is fine - the stack just needs to be disjoint from the
> ordinary kernel mode task stack so that buggy firmware is less likely
> to corrupt it, and so that we can recover from an unexpected
> synchronous exception more reliably.
>
> In that sense, the old and the new code are equivalent, so no
> objections from me.
Thanks. I will send an update with the update that Catalin and Mark
suggested.
Thanks!
--breno
next prev parent reply other threads:[~2025-07-04 12:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-24 12:55 [PATCH] arm64: efi: Fix KASAN false positive for EFI runtime stack Breno Leitao
2025-07-03 16:35 ` Catalin Marinas
2025-07-04 8:26 ` Ard Biesheuvel
2025-07-04 12:36 ` Breno Leitao [this message]
2025-07-04 13:33 ` Will Deacon
2025-07-04 13:37 ` Ard Biesheuvel
2025-07-04 13:40 ` Mark Rutland
2025-07-07 0:45 ` Catalin Marinas
2025-07-07 16:08 ` Breno Leitao
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=aGfK2N6po39zyVIp@gmail.com \
--to=leitao@debian.org \
--cc=andreyknvl@gmail.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=kasan-dev@googlegroups.com \
--cc=kernel-team@meta.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rmikey@meta.com \
--cc=usamaarif642@gmail.com \
--cc=will@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.