All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Matt Fleming <matt@codeblueprint.co.uk>,
	LKML <linux-kernel@vger.kernel.org>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Ingo Molnar <mingo@kernel.org>, Kees Cook <keescook@chromium.org>,
	thgarnie@google.com, caoj.fnst@cn.fujitsu.com,
	izumi.taku@jp.fujitsu.com
Subject: Re: [PATCH v2 2/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions
Date: Wed, 5 Jul 2017 07:16:38 +0800	[thread overview]
Message-ID: <20170704231638.GA19994@x1> (raw)
In-Reply-To: <alpine.DEB.2.20.1707041744510.9000@nanos>

On 07/04/17 at 05:46pm, Thomas Gleixner wrote:
> 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.

Sorry, I must be dizzy at late night of yesterday, just gave wrong
answer when questioned.

> 
> It's just Baoquans copy and paste wreckage which is busted.
> 
> Thanks,
> 
> 	tglx
> 

      reply	other threads:[~2017-07-04 23:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-04  8:04 [PATCH v2 0/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions Baoquan He
2017-07-04  8:04 ` [PATCH v2 1/2] x86/boot/KASLR: Adapt process_e820_entry for any type of memory entry Baoquan He
2017-07-05 22:06   ` Kees Cook
2017-07-06  1:21     ` Baoquan He
2017-07-04  8:04 ` [PATCH v2 2/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions Baoquan He
2017-07-04 14:00   ` Thomas Gleixner
2017-07-04 14:30     ` Baoquan He
2017-07-04 14:46       ` Thomas Gleixner
2017-07-04 15:36         ` Matt Fleming
2017-07-04 15:46           ` Thomas Gleixner
2017-07-04 23:16             ` Baoquan He [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170704231638.GA19994@x1 \
    --to=bhe@redhat.com \
    --cc=caoj.fnst@cn.fujitsu.com \
    --cc=hpa@zytor.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=thgarnie@google.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.