public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: kyle.d.pelton@intel.com, mingo@redhat.com, x86@kernel.org,
	hpa@zytor.com, linux-kernel@vger.kernel.org, bp@suse.de,
	wei@redhat.com, mingo@kernel.org, tglx@linutronix.de,
	kirill.shutemov@linux.intel.com
Subject: [tip:x86/urgent] x86/boot/compressed/64: Do not corrupt EDX on EFER.LME=1 setting
Date: Wed, 6 Feb 2019 10:04:11 -0800	[thread overview]
Message-ID: <tip-45b13b424faafb81c8c44541f093a682fdabdefc@git.kernel.org> (raw)
In-Reply-To: <20190206115253.1907-1-kirill.shutemov@linux.intel.com>

Commit-ID:  45b13b424faafb81c8c44541f093a682fdabdefc
Gitweb:     https://git.kernel.org/tip/45b13b424faafb81c8c44541f093a682fdabdefc
Author:     Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
AuthorDate: Wed, 6 Feb 2019 14:52:53 +0300
Committer:  Borislav Petkov <bp@suse.de>
CommitDate: Wed, 6 Feb 2019 18:56:18 +0100

x86/boot/compressed/64: Do not corrupt EDX on EFER.LME=1 setting

RDMSR in the trampoline code overwrites EDX but that register is used
to indicate whether 5-level paging has to be enabled and if clobbered,
leads to failure to boot on a 5-level paging machine.

Preserve EDX on the stack while we are dealing with EFER.

Fixes: b677dfae5aa1 ("x86/boot/compressed/64: Set EFER.LME=1 in 32-bit trampoline before returning to long mode")
Reported-by: Kyle D Pelton <kyle.d.pelton@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: dave.hansen@linux.intel.com
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wei Huang <wei@redhat.com>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20190206115253.1907-1-kirill.shutemov@linux.intel.com
---
 arch/x86/boot/compressed/head_64.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index f105ae8651c9..f62e347862cc 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -602,10 +602,12 @@ ENTRY(trampoline_32bit_src)
 3:
 	/* Set EFER.LME=1 as a precaution in case hypervsior pulls the rug */
 	pushl	%ecx
+	pushl	%edx
 	movl	$MSR_EFER, %ecx
 	rdmsr
 	btsl	$_EFER_LME, %eax
 	wrmsr
+	popl	%edx
 	popl	%ecx
 
 	/* Enable PAE and LA57 (if required) paging modes */

  parent reply	other threads:[~2019-02-06 18:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06 11:52 [PATCH] x86/boot/compressed/64: Do not corrupt EDX on EFER.LME=1 setting Kirill A. Shutemov
2019-02-06 15:21 ` Borislav Petkov
2019-02-06 15:47   ` Kirill A. Shutemov
2019-02-06 18:11     ` Borislav Petkov
2019-02-06 18:13     ` [tip:x86/cleanups] x86/boot/compressed/64: Explain paging_prepare()'s return value tip-bot for Kirill A. Shutemov
2019-02-06 18:04 ` tip-bot for Kirill A. Shutemov [this message]
2019-02-06 19:50 ` [PATCH] x86/boot/compressed/64: Do not corrupt EDX on EFER.LME=1 setting Wei Huang

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=tip-45b13b424faafb81c8c44541f093a682fdabdefc@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bp@suse.de \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kyle.d.pelton@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=wei@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox