Skip to content

Commit

Permalink
x86/boot/compressed/64: Reload CS in startup_32
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Joerg Roedel authored and Borislav Petkov committed Mar 18, 2021
1 parent eab696d commit 0c289ff
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion arch/x86/boot/compressed/head_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0c289ff

Please sign in to comment.