[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1707041744510.9000@nanos>
Date: Tue, 4 Jul 2017 17:46:35 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Matt Fleming <matt@...eblueprint.co.uk>
cc: Baoquan He <bhe@...hat.com>, LKML <linux-kernel@...r.kernel.org>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Ingo Molnar <mingo@...nel.org>,
Kees Cook <keescook@...omium.org>, thgarnie@...gle.com,
caoj.fnst@...fujitsu.com, izumi.taku@...fujitsu.com
Subject: Re: [PATCH v2 2/2] x86/boot/KASLR: Restrict kernel to be randomized
in mirror regions
On Tue, 4 Jul 2017, Matt Fleming wrote:
> On Tue, 04 Jul, at 04:46:58PM, Thomas Gleixner wrote:
> > On Tue, 4 Jul 2017, Baoquan He wrote:
> >
> > > In fact I just referred to code in setup_arch(). Now I have a question,
> > > though CONFIG_EFI=y but efi firmware is not enabled,
> > > boot_params.efi_info.efi_loader_signature should be initilized to 0.
> > > Then below code is also problematic.
> > >
> > > #ifdef CONFIG_EFI
> > > if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
> > > EFI32_LOADER_SIGNATURE, 4)) {
> > > set_bit(EFI_BOOT, &efi.flags);
> > > } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
> > > EFI64_LOADER_SIGNATURE, 4)) {
> > > set_bit(EFI_BOOT, &efi.flags);
> > > set_bit(EFI_64BIT, &efi.flags);
> > > }
> > >
> > > if (efi_enabled(EFI_BOOT))
> > > efi_memblock_x86_reserve_range();
> > > #endif
> >
> > Indeed. Matt?
>
> It's possibly that I'm missing some context, but boot_params should be
> zero'd -- the x86 boot protocol requires that the entire data
> structure be zero'd on allocation.
>
> Have I missed something?
No. I misread the code. The strncmp() operates on
boot_params.efi_info.efi_loader_signature itself, so yes, all is fine.
It's just Baoquans copy and paste wreckage which is busted.
Thanks,
tglx
Powered by blists - more mailing lists