]> xenbits.xensource.com Git - people/tklengyel/xen.git/commitdiff
x86/spec-ctrl: Disable retpolines with CET-IBT
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 28 Feb 2022 19:26:37 +0000 (19:26 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 1 Mar 2022 12:34:46 +0000 (12:34 +0000)
CET-IBT depend on executing indirect branches for protections to apply.
Extend the clobber for CET-SS to all of CET.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/spec_ctrl.c

index 2d4cf5c7ef80ca400f1ef93bd9f4adaec42d3413..12bf1c5722f91369fc1d34b79b4d947793b8dc45 100644 (file)
@@ -944,10 +944,11 @@ void __init init_speculation_mitigations(void)
                      boot_cpu_has(X86_FEATURE_IBRS));
 
     /*
-     * First, disable the use of retpolines if Xen is using shadow stacks, as
-     * they are incompatible.
+     * First, disable the use of retpolines if Xen is using CET.  Retpolines
+     * are a ROP gadget so incompatbile with Shadow Stacks, while IBT depends
+     * on executing indirect branches for the safety properties to apply.
      */
-    if ( cpu_has_xen_shstk &&
+    if ( (read_cr4() & X86_CR4_CET) &&
          (opt_thunk == THUNK_DEFAULT || opt_thunk == THUNK_RETPOLINE) )
         thunk = THUNK_JMP;