Commit 45b13b42 authored by Kirill A. Shutemov's avatar Kirill A. Shutemov Committed by Borislav Petkov

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: b677dfae ("x86/boot/compressed/64: Set EFER.LME=1 in 32-bit trampoline before returning to long mode")
Reported-by: default avatarKyle D Pelton <kyle.d.pelton@intel.com>
Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: default avatarBorislav 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
parent d28af26f
...@@ -602,10 +602,12 @@ ENTRY(trampoline_32bit_src) ...@@ -602,10 +602,12 @@ ENTRY(trampoline_32bit_src)
3: 3:
/* Set EFER.LME=1 as a precaution in case hypervsior pulls the rug */ /* Set EFER.LME=1 as a precaution in case hypervsior pulls the rug */
pushl %ecx pushl %ecx
pushl %edx
movl $MSR_EFER, %ecx movl $MSR_EFER, %ecx
rdmsr rdmsr
btsl $_EFER_LME, %eax btsl $_EFER_LME, %eax
wrmsr wrmsr
popl %edx
popl %ecx popl %ecx
/* Enable PAE and LA57 (if required) paging modes */ /* Enable PAE and LA57 (if required) paging modes */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment