From: Matt Fleming <matt@codeblueprint.co.uk>
To: Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
"H . Peter Anvin" <hpa@zytor.com>
Cc: Sai Praneeth <sai.praneeth.prakhya@intel.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
Matt Fleming <matt@codeblueprint.co.uk>,
Borislav Petkov <bp@alien8.de>, Dave Young <dyoung@redhat.com>,
Lee Chun-Yi <jlee@suse.com>,
Ravi Shankar <ravi.v.shankar@intel.com>,
Ricardo Neri <ricardo.neri@intel.com>
Subject: [PATCH 3/5] x86/efi: Disable runtime services on kexec kernel if booted with efi=old_map
Date: Fri, 26 May 2017 12:36:49 +0100 [thread overview]
Message-ID: <20170526113652.21339-4-matt@codeblueprint.co.uk> (raw)
In-Reply-To: <20170526113652.21339-1-matt@codeblueprint.co.uk>
From: Sai Praneeth <sai.praneeth.prakhya@intel.com>
Booting kexec kernel with "efi=old_map" in kernel command line hits
kernel panic as shown below.
BUG: unable to handle kernel paging request at ffff88007fe78070
IP: virt_efi_set_variable.part.7+0x63/0x1b0
PGD 7ea28067
PUD 7ea2b067
PMD 7ea2d067
PTE 0
[...]
Call Trace:
virt_efi_set_variable+0x5d/0x70
efi_delete_dummy_variable+0x7a/0x80
efi_enter_virtual_mode+0x3f6/0x4a7
start_kernel+0x375/0x400
x86_64_start_reservations+0x2a/0x2c
x86_64_start_kernel+0x168/0x176
start_cpu+0x14/0x14
[ efi=old_map was never intended to work with kexec. The problem with
using efi=old_map is that the virtual addresses are assigned from the
memory region used by other kernel mappings; vmalloc() space.
Potentially there could be collisions when booting kexec if something
else is mapped at the virtual address we allocated for runtime service
regions in the initial boot - Matt Fleming ]
Since kexec was never intended to work with efi=old_map, disable
runtime services in kexec if booted with efi=old_map, so that we don't
panic.
Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Ricardo Neri <ricardo.neri@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ravi Shankar <ravi.v.shankar@intel.com>
Tested-by: Lee Chun-Yi <jlee@suse.com>
Acked-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
---
arch/x86/platform/efi/efi.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 7e76a4d8304b..43b96f5f78ba 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -828,9 +828,11 @@ static void __init kexec_enter_virtual_mode(void)
/*
* We don't do virtual mode, since we don't do runtime services, on
- * non-native EFI
+ * non-native EFI. With efi=old_map, we don't do runtime services in
+ * kexec kernel because in the initial boot something else might
+ * have been mapped at these virtual addresses.
*/
- if (!efi_is_native()) {
+ if (!efi_is_native() || efi_enabled(EFI_OLD_MEMMAP)) {
efi_memmap_unmap();
clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
return;
--
2.12.2
next prev parent reply other threads:[~2017-05-26 11:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-26 11:36 [GIT PULL 0/5] EFI urgent fixes Matt Fleming
2017-05-26 11:36 ` [PATCH 1/5] efi: Don't issue error message when booted under xen Matt Fleming
2017-05-28 9:44 ` [tip:efi/urgent] efi: Don't issue error message when booted under Xen tip-bot for Juergen Gross
2017-05-26 11:36 ` [PATCH 2/5] efi: Remove duplicate 'const' specifiers Matt Fleming
2017-05-28 9:44 ` [tip:efi/urgent] " tip-bot for Arnd Bergmann
2017-05-26 11:36 ` Matt Fleming [this message]
2017-05-28 9:45 ` [tip:efi/urgent] x86/efi: Disable runtime services on kexec kernel if booted with efi=old_map tip-bot for Sai Praneeth
2017-05-26 11:36 ` [PATCH 4/5] x86/efi: Correct ident mapping of efi old_map when kalsr enabled Matt Fleming
2017-05-28 9:45 ` [tip:efi/urgent] x86/efi: Correct EFI identity mapping under 'efi=old_map' when KASLR is enabled tip-bot for Baoquan He
2017-05-26 11:36 ` [PATCH 5/5] efi/bgrt: Skip efi_bgrt_init in case of non-efi boot Matt Fleming
2017-05-28 9:46 ` [tip:efi/urgent] efi/bgrt: Skip efi_bgrt_init() in case of non-EFI boot tip-bot for Dave Young
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=20170526113652.21339-4-matt@codeblueprint.co.uk \
--to=matt@codeblueprint.co.uk \
--cc=ard.biesheuvel@linaro.org \
--cc=bp@alien8.de \
--cc=dyoung@redhat.com \
--cc=hpa@zytor.com \
--cc=jlee@suse.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=ravi.v.shankar@intel.com \
--cc=ricardo.neri@intel.com \
--cc=sai.praneeth.prakhya@intel.com \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox