[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240131083511.GIZboGP8jPIrUZA8DF@fat_crate.local>
Date: Wed, 31 Jan 2024 09:35:11 +0100
From: Borislav Petkov <bp@...en8.de>
To: Ard Biesheuvel <ardb+git@...gle.com>
Cc: linux-kernel@...r.kernel.org, Ard Biesheuvel <ardb@...nel.org>,
Kevin Loughlin <kevinloughlin@...gle.com>,
Tom Lendacky <thomas.lendacky@....com>,
Dionna Glaze <dionnaglaze@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Justin Stitt <justinstitt@...gle.com>,
Kees Cook <keescook@...omium.org>, Brian Gerst <brgerst@...il.com>,
linux-arch@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH v3 02/19] x86/boot: Move mem_encrypt= parsing to the
decompressor
On Mon, Jan 29, 2024 at 07:05:05PM +0100, Ard Biesheuvel wrote:
> +/*
> + * Set the memory encryption xloadflag based on the mem_encrypt= command line
> + * parameter, if provided. If not, the consumer of the flag decides what the
> + * default behavior should be.
> + */
> +static void set_mem_encrypt_flag(struct setup_header *hdr)
parse_mem_encrypt
> +{
> + hdr->xloadflags &= ~(XLF_MEM_ENCRYPTION | XLF_MEM_ENCRYPTION_ENABLED);
> +
> + if (IS_ENABLED(CONFIG_ARCH_HAS_MEM_ENCRYPT)) {
That's unconditionally enabled on x86:
select ARCH_HAS_MEM_ENCRYPT
in x86/Kconfig.
Which sounds like you need a single XLF_MEM_ENCRYPT and simplify this
more.
> + int on = cmdline_find_option_bool("mem_encrypt=on");
> + int off = cmdline_find_option_bool("mem_encrypt=off");
> +
> + if (on || off)
> + hdr->xloadflags |= XLF_MEM_ENCRYPTION;
> + if (on > off)
> + hdr->xloadflags |= XLF_MEM_ENCRYPTION_ENABLED;
> + }
> +}
Otherwise, I like the simplification.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists