[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240424182659.GA2126602@dev-arch.thelio-3990X>
Date: Wed, 24 Apr 2024 11:26:59 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Ard Biesheuvel <ardb+git@...gle.com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
Ard Biesheuvel <ardb@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Eric Biederman <ebiederm@...ssion.com>, kexec@...ts.infradead.org,
Nick Desaulniers <ndesaulniers@...gle.com>,
Kees Cook <keescook@...omium.org>, Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>,
Masahiro Yamada <masahiroy@...nel.org>
Subject: Re: [RFC PATCH 2/9] x86/purgatory: Simplify stack handling
On Wed, Apr 24, 2024 at 05:53:12PM +0200, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@...nel.org>
>
> The x86 purgatory, which does little more than verify a SHA-256 hash of
> the loaded segments, currently uses three different stacks:
> - one in .bss that is used to call the purgatory C code
> - one in .rodata that is only used to switch to an updated code segment
> descriptor in the GDT
> - one in .data, which allows it to be prepopulated from the kexec loader
> in theory, but this is not actually being taken advantage of.
>
> Simplify this, by dropping the latter two stacks, as well as the loader
> logic that programs RSP.
>
> Both the stacks in .bss and .data are 4k aligned, but 16 byte alignment
> is more than sufficient.
>
> Signed-off-by: Ard Biesheuvel <ardb@...nel.org>
> ---
> arch/x86/include/asm/kexec.h | 1 -
> arch/x86/kernel/kexec-bzimage64.c | 8 --------
> arch/x86/purgatory/entry64.S | 8 --------
> arch/x86/purgatory/setup-x86_64.S | 2 +-
> arch/x86/purgatory/stack.S | 18 ------------------
This needs a small fix up to build.
make[6]: *** No rule to make target 'arch/x86/purgatory/stack.o', needed by 'arch/x86/purgatory/purgatory.ro'.
diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
index acc09799af2a..2b6b2fb033d6 100644
--- a/arch/x86/purgatory/Makefile
+++ b/arch/x86/purgatory/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
OBJECT_FILES_NON_STANDARD := y
-purgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string.o
+purgatory-y := purgatory.o setup-x86_$(BITS).o sha256.o entry64.o string.o
targets += $(purgatory-y)
PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
Powered by blists - more mailing lists