summaryrefslogtreecommitdiffstats
path: root/arch/x86/boot
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2021-03-10 09:43:20 +0100
committerBorislav Petkov <bp@suse.de>2021-03-18 16:44:43 +0100
commit0c289ff81c24033777fab23019039f11e1449ba4 (patch)
treeb8f02c4a39c8122fcf34988b9db5dbcec48e61cb /arch/x86/boot
parenteab696d8e8b9c9d600be6fad8dd8dfdfaca6ca7c (diff)
downloadlinux-0c289ff81c24033777fab23019039f11e1449ba4.tar.bz2
x86/boot/compressed/64: Reload CS in startup_32
Exception handling in the startup_32 boot path requires the CS selector to be correctly set up. Reload it from the current GDT. Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/20210312123824.306-4-joro@8bytes.org
Diffstat (limited to 'arch/x86/boot')
-rw-r--r--arch/x86/boot/compressed/head_64.S9
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index e94874f4bbc1..c59c80ca546d 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -107,9 +107,16 @@ SYM_FUNC_START(startup_32)
movl %eax, %gs
movl %eax, %ss
-/* setup a stack and make sure cpu supports long mode. */
+ /* Setup a stack and load CS from current GDT */
leal rva(boot_stack_end)(%ebp), %esp
+ pushl $__KERNEL32_CS
+ leal rva(1f)(%ebp), %eax
+ pushl %eax
+ lretl
+1:
+
+ /* Make sure cpu supports long mode. */
call verify_cpu
testl %eax, %eax
jnz .Lno_longmode