Linux-EFI Archive on
 help / color / Atom feed
From: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/>
To: Ingo Molnar <>,
	Thomas Gleixner <>,
	"H . Peter Anvin" <>
Cc: Sai Praneeth
	Ard Biesheuvel
	Matt Fleming
	Borislav Petkov <>,
	Dave Young <>,
	Lee Chun-Yi <jlee-IBi9RG/>,
	Ravi Shankar
	Ricardo Neri
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
Message-ID: <> (raw)
In-Reply-To: <20170526113652.21339-1-matt-mF/unelCI9GS6iBeEJttW/>

From: Sai Praneeth <>

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:

[ 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

Signed-off-by: Sai Praneeth Prakhya <>
Cc: Borislav Petkov <>
Cc: Ricardo Neri <>
Cc: Ard Biesheuvel <>
Cc: Ravi Shankar <>
Tested-by: Lee Chun-Yi <jlee-IBi9RG/>
Acked-by: Dave Young <>
Signed-off-by: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/>
 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)) {
 		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);

  parent reply index

Thread overview: 6+ 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
     [not found] ` <20170526113652.21339-1-matt-mF/unelCI9GS6iBeEJttW/>
2017-05-26 11:36   ` [PATCH 2/5] efi: Remove duplicate 'const' specifiers Matt Fleming
2017-05-26 11:36   ` Matt Fleming [this message]
2017-05-26 11:36 ` [PATCH 4/5] x86/efi: Correct ident mapping of efi old_map when kalsr enabled Matt Fleming
2017-05-26 11:36 ` [PATCH 5/5] efi/bgrt: Skip efi_bgrt_init in case of non-efi boot Matt Fleming

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:

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

  git send-email \ \
    --to=matt-mf/unelci9gs6ibeejttw/ \ \ \ \ \
    --cc=jlee-IBi9RG/ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-EFI Archive on

Archives are clonable:
	git clone --mirror linux-efi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-efi linux-efi/ \
	public-inbox-index linux-efi

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone