All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: linux-efi@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: Ard Biesheuvel <ardb@kernel.org>,
	linux-kernel@vger.kernel.org,
	Arvind Sankar <nivedita@alum.mit.edu>,
	Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH 3/3] x86/efistub: disable paging at mixed mode entry
Date: Tue, 24 Dec 2019 14:29:09 +0100	[thread overview]
Message-ID: <20191224132909.102540-4-ardb@kernel.org> (raw)
In-Reply-To: <20191224132909.102540-1-ardb@kernel.org>

The EFI mixed mode entry code goes through the ordinary startup_32()
routine before jumping into the kernel's EFI boot code in 64-bit
mode. The 32-bit startup code must be entered with paging disabled,
but this is not documented as a requirement for the EFI handover
protocol, and so we should disable paging explicitly when entering
the kernel from 32-bit EFI firmware.

Cc: <stable@vger.kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/x86/boot/compressed/head_64.S | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index 58a512e33d8d..ee60b81944a7 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -244,6 +244,11 @@ SYM_FUNC_START(efi32_stub_entry)
 	leal	efi32_config(%ebp), %eax
 	movl	%eax, efi_config(%ebp)
 
+	/* Disable paging */
+	movl	%cr0, %eax
+	btrl	$X86_CR0_PG_BIT, %eax
+	movl	%eax, %cr0
+
 	jmp	startup_32
 SYM_FUNC_END(efi32_stub_entry)
 #endif
-- 
2.20.1


  parent reply	other threads:[~2019-12-24 13:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-24 13:29 [GIT PULL 0/3] EFI fixes for v5.5 Ard Biesheuvel
2019-12-24 13:29 ` [PATCH 1/3] efi/earlycon: Fix write-combine mapping on x86 Ard Biesheuvel
2019-12-25 10:38   ` [tip: efi/urgent] " tip-bot2 for Arvind Sankar
2019-12-24 13:29 ` [PATCH 2/3] efi/libstub/random: Initialize pointer variables to zero for mixed mode Ard Biesheuvel
2019-12-25 10:38   ` [tip: efi/urgent] " tip-bot2 for Hans de Goede
2019-12-24 13:29 ` Ard Biesheuvel [this message]
2019-12-25 10:38   ` [tip: efi/urgent] x86/efistub: Disable paging at mixed mode entry tip-bot2 for Ard Biesheuvel
2019-12-25  9:50 ` [GIT PULL 0/3] EFI fixes for v5.5 Ingo Molnar

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=20191224132909.102540-4-ardb@kernel.org \
    --to=ardb@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=nivedita@alum.mit.edu \
    --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 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.