]> xenbits.xensource.com Git - people/tklengyel/xen.git/commitdiff
x86/Kconfig: introduce option to select retpoline usage
authorRoger Pau Monne <roger.pau@citrix.com>
Fri, 18 Feb 2022 14:34:16 +0000 (15:34 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 21 Feb 2022 18:17:56 +0000 (18:17 +0000)
Add a new Kconfig option under the "Speculative hardening" section
that allows selecting whether to enable retpoline. This depends on the
underlying compiler having retpoline support.

Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/Kconfig
xen/common/Kconfig

index 14658740972337ec482ce2574677015d68643089..41198b0f96eda0cda26f7d17ecf42da8c5e8e7a6 100644 (file)
@@ -36,10 +36,6 @@ config CC_HAS_INDIRECT_THUNK
        def_bool $(cc-option,-mindirect-branch-register) || \
                 $(cc-option,-mretpoline-external-thunk)
 
-config INDIRECT_THUNK
-       def_bool y
-       depends on CC_HAS_INDIRECT_THUNK
-
 config HAS_AS_CET_SS
        # binutils >= 2.29 or LLVM >= 6
        def_bool $(as-instr,wrssq %rax$(comma)0;setssbsy)
index db687b1785e77ed79c8fcc6e9386595bcb0cafc6..64439438891c06d063eb6e630c4342b17a30f789 100644 (file)
@@ -85,6 +85,20 @@ config STATIC_MEMORY
 
 menu "Speculative hardening"
 
+config INDIRECT_THUNK
+       bool "Speculative Branch Target Injection Protection"
+       depends on CC_HAS_INDIRECT_THUNK
+       default y
+       help
+         Contemporary processors may use speculative execution as a
+         performance optimisation, but this can potentially be abused by an
+         attacker to leak data via speculative sidechannels.
+
+         One source of data leakage is via branch target injection.
+
+         When enabled, indirect branches are implemented using a new construct
+         called "retpoline" that prevents speculation.
+
 config SPECULATIVE_HARDEN_ARRAY
        bool "Speculative Array Hardening"
        default y