From: Borislav Petkov <bp@alien8.de>
To: Kairui Song <kasong@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
Matthew Garrett <matthewgarrett@google.com>,
Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
Baoquan He <bhe@redhat.com>, Dave Young <dyoung@redhat.com>,
x86@kernel.org, linux-efi@vger.kernel.org
Subject: Re: [PATCH v3] x86, efi: never relocate kernel below lowest acceptable address
Date: Mon, 14 Oct 2019 12:14:19 +0200 [thread overview]
Message-ID: <20191014101419.GA4715@zn.tnic> (raw)
In-Reply-To: <20191012034421.25027-1-kasong@redhat.com>
On Sat, Oct 12, 2019 at 11:44:21AM +0800, Kairui Song wrote:
> Currently, kernel fails to boot on some HyperV VMs when using EFI.
> And it's a potential issue on all platforms.
>
> It's caused a broken kernel relocation on EFI systems, when below three
> conditions are met:
>
> 1. Kernel image is not loaded to the default address (LOAD_PHYSICAL_ADDR)
> by the loader.
> 2. There isn't enough room to contain the kernel, starting from the
> default load address (eg. something else occupied part the region).
> 3. In the memmap provided by EFI firmware, there is a memory region
> starts below LOAD_PHYSICAL_ADDR, and suitable for containing the
> kernel.
>
> Efi stub will perform a kernel relocation when condition 1 is met. But
> due to condition 2, efi stub can't relocate kernel to the preferred
> address, so it fallback to query and alloc from EFI firmware for lowest
Your spelling of "EFI" is like a random number generator in this
paragraph: "Efi", "efi" and "EFI". Can you please be more careful when
writing your commit messages? They're not some random text you hurriedly
jot down before sending the patch but a most important description of
why a change is being done.
And if you don't see their importance now, just try doing some git
archeology, trying to understand why a change has been done in the past
and then encounter a commit message two-liner which doesn't say sh*t.
Then you'll start appreciating properly written commit messages.
> usable memory region.
>
> It's incorrect to use the lowest memory address. In later stage, kernel
> will assume LOAD_PHYSICAL_ADDR as the minimal acceptable relocate address,
> but efi stub will end up relocating kernel below it.
Why don't you simply explain what
choose_random_location()->find_random_virt_addr() does? That's the
problem you're solving, right? KASLR using LOAD_PHYSICAL_ADDR as the
minimum...
> The later kernel decompressing code will forcefully correct the wrong
> kernel load location,
... or do you mean by that the dance in
arch/x86/boot/compressed/head_64.S where we move the kernel temporarily
to LOAD_PHYSICAL_ADDR for the decompression?
You can simply say that here...
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2019-10-14 10:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-12 3:44 [PATCH v3] x86, efi: never relocate kernel below lowest acceptable address Kairui Song
2019-10-14 10:14 ` Borislav Petkov [this message]
2019-10-14 20:21 ` Jarkko Sakkinen
2019-10-14 21:18 ` Borislav Petkov
2019-10-16 15:20 ` Jarkko Sakkinen
2019-10-16 15:23 ` Joe Perches
2019-10-16 15:48 ` Borislav Petkov
2019-10-16 23:25 ` Joe Perches
2019-10-16 16:27 ` Jarkko Sakkinen
2019-10-16 17:54 ` Joe Perches
2019-10-15 5:23 ` Kairui Song
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=20191014101419.GA4715@zn.tnic \
--to=bp@alien8.de \
--cc=ard.biesheuvel@linaro.org \
--cc=bhe@redhat.com \
--cc=dyoung@redhat.com \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=kasong@redhat.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthewgarrett@google.com \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--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.