[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXHUiBO0d926eWTtWZp_hvwHsVLzzn+fdS1EYoXHxpH+iA@mail.gmail.com>
Date: Wed, 19 Oct 2022 09:06:45 +0200
From: Ard Biesheuvel <ardb@...nel.org>
To: Evgeniy Baskov <baskov@...ras.ru>
Cc: Borislav Petkov <bp@...en8.de>, Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Alexey Khoroshilov <khoroshilov@...ras.ru>,
lvc-project@...uxtesting.org, x86@...nel.org,
linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH 03/16] x86/boot: Set cr0 to known state in trampoline
On Tue, 6 Sept 2022 at 12:41, Evgeniy Baskov <baskov@...ras.ru> wrote:
>
> Ensure WP bit to be set to prevent boot code from writing to
> non-writable memory pages.
>
> Signed-off-by: Evgeniy Baskov <baskov@...ras.ru>
> ---
> arch/x86/boot/compressed/head_64.S | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
> index d33f060900d2..5273367283b7 100644
> --- a/arch/x86/boot/compressed/head_64.S
> +++ b/arch/x86/boot/compressed/head_64.S
> @@ -619,9 +619,8 @@ SYM_CODE_START(trampoline_32bit_src)
> /* Set up new stack */
> leal TRAMPOLINE_32BIT_STACK_END(%ecx), %esp
>
> - /* Disable paging */
> - movl %cr0, %eax
> - btrl $X86_CR0_PG_BIT, %eax
Why do we no longer care about CR0's prior value?
> + /* Disable paging and setup CR0 */
> + movl $(CR0_STATE & ~X86_CR0_PG), %eax
> movl %eax, %cr0
>
> /* Check what paging mode we want to be in after the trampoline */
> --
> 2.35.1
>
Powered by blists - more mailing lists