Skip to content

Commit 4c60526

Browse files
committed
Merge tag 'x86_urgent_for_v6.4_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fix from Borislav Petkov: - Set up the kernel CS earlier in the boot process in case EFI boots the kernel after bypassing the decompressor and the CS descriptor used ends up being the EFI one which is not mapped in the identity page table, leading to early SEV/SNP guest communication exceptions resulting in the guest crashing * tag 'x86_urgent_for_v6.4_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/head/64: Switch to KERNEL_CS as soon as new GDT is installed
2 parents 65d7ca5 + a37f269 commit 4c60526

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

arch/x86/kernel/head_64.S

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ SYM_CODE_START_NOALIGN(startup_64)
7777
call startup_64_setup_env
7878
popq %rsi
7979

80+
/* Now switch to __KERNEL_CS so IRET works reliably */
81+
pushq $__KERNEL_CS
82+
leaq .Lon_kernel_cs(%rip), %rax
83+
pushq %rax
84+
lretq
85+
86+
.Lon_kernel_cs:
87+
UNWIND_HINT_END_OF_STACK
88+
8089
#ifdef CONFIG_AMD_MEM_ENCRYPT
8190
/*
8291
* Activate SEV/SME memory encryption if supported/enabled. This needs to
@@ -90,15 +99,6 @@ SYM_CODE_START_NOALIGN(startup_64)
9099
popq %rsi
91100
#endif
92101

93-
/* Now switch to __KERNEL_CS so IRET works reliably */
94-
pushq $__KERNEL_CS
95-
leaq .Lon_kernel_cs(%rip), %rax
96-
pushq %rax
97-
lretq
98-
99-
.Lon_kernel_cs:
100-
UNWIND_HINT_END_OF_STACK
101-
102102
/* Sanitize CPU configuration */
103103
call verify_cpu
104104

0 commit comments

Comments
 (0)