[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <58b9f97c-36d5-6b9e-5336-14ad3a09ad18@citrix.com>
Date: Wed, 19 Oct 2022 07:57:57 +0000
From: Andrew Cooper <Andrew.Cooper3@...rix.com>
To: Evgeniy Baskov <baskov@...ras.ru>, Ard Biesheuvel <ardb@...nel.org>
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" <lvc-project@...uxtesting.org>,
"x86@...nel.org" <x86@...nel.org>,
"linux-efi@...r.kernel.org" <linux-efi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>,
Andrew Cooper <Andrew.Cooper3@...rix.com>
Subject: Re: [PATCH 06/16] x86/boot: Setup memory protection for bzImage code
On 06/09/2022 11:41, Evgeniy Baskov wrote:
> diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
> index 5273367283b7..889ca7176aa7 100644
> --- a/arch/x86/boot/compressed/head_64.S
> +++ b/arch/x86/boot/compressed/head_64.S
> @@ -602,6 +603,28 @@ SYM_FUNC_START_LOCAL_NOALIGN(.Lrelocated)
> jmp *%rax
> SYM_FUNC_END(.Lrelocated)
>
> +SYM_FUNC_START_LOCAL_NOALIGN(startup32_enable_nx_if_supported)
> + pushq %rbx
> +
> + leaq has_nx(%rip), %rcx
> +
> + mov $0x80000001, %eax
> + cpuid
> + btl $20, %edx
btl $(X86_FEATURE_NX & 31), %edx
But also need to check for the availability of the extended leaf in the
first place.
> + jnc .Lnonx
> +
> + movl $1, (%rcx)
Your pointer has been clobbered with some feature flags.
movl $1, has_nx(%rip)
will work fine without needing the intermediary lea.
~Andrew
Powered by blists - more mailing lists