Merge back cpufreq updates for v5.11.
[linux-2.6-microblaze.git] / arch / x86 / kernel / head_64.S
index 7eb2a1c..3c41773 100644 (file)
@@ -161,6 +161,21 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL)
 
        /* Setup early boot stage 4-/5-level pagetables. */
        addq    phys_base(%rip), %rax
+
+       /*
+        * For SEV guests: Verify that the C-bit is correct. A malicious
+        * hypervisor could lie about the C-bit position to perform a ROP
+        * attack on the guest by writing to the unencrypted stack and wait for
+        * the next RET instruction.
+        * %rsi carries pointer to realmode data and is callee-clobbered. Save
+        * and restore it.
+        */
+       pushq   %rsi
+       movq    %rax, %rdi
+       call    sev_verify_cbit
+       popq    %rsi
+
+       /* Switch to new page-table */
        movq    %rax, %cr3
 
        /* Ensure I am executing from virtual addresses */
@@ -279,6 +294,7 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL)
 SYM_CODE_END(secondary_startup_64)
 
 #include "verify_cpu.S"
+#include "sev_verify_cbit.S"
 
 #ifdef CONFIG_HOTPLUG_CPU
 /*