x86/speculation: Make all RETbleed mitigations depend on X86_64
authorBen Hutchings <ben@decadent.org.uk>
Sat, 23 Jul 2022 14:20:34 +0000 (16:20 +0200)
committerSalvatore Bonaccorso <carnil@debian.org>
Wed, 10 Aug 2022 18:11:48 +0000 (19:11 +0100)
Forwarded: https://lore.kernel.org/lkml/YtwSR3NNsWp1ohfV@decadent.org.uk/T/

The mitigations for RETBleed are currently ineffective on x86_32 since
entry_32.S does not use the required macros.  However, for an x86_32
target, the kconfig symbols for them are still enabled by default and
/sys/devices/system/cpu/vulnerabilities/retbleed will wrongly report
that mitigations are in place.

Make all of these symbols depend on X86_64, and only enable RETHUNK by
default on X86_64.

Cc: stable@vger.kernel.org
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic bugfix/x86
Gbp-Pq: Name x86-speculation-make-all-retbleed-mitigations-depend.patch

arch/x86/Kconfig

index f1f354819851a9a90781294de4a6af0d93e11f6c..e68900b124861dcfbeee942477acfb98bbe71e52 100644 (file)
@@ -2469,7 +2469,7 @@ config RETPOLINE
 config RETHUNK
        bool "Enable return-thunks"
        depends on RETPOLINE && CC_HAS_RETURN_THUNK
-       default y
+       default y if X86_64
        help
          Compile the kernel with the return-thunks compiler option to guard
          against kernel-to-user data leaks by avoiding return speculation.
@@ -2478,21 +2478,21 @@ config RETHUNK
 
 config CPU_UNRET_ENTRY
        bool "Enable UNRET on kernel entry"
-       depends on CPU_SUP_AMD && RETHUNK
+       depends on CPU_SUP_AMD && RETHUNK && X86_64
        default y
        help
          Compile the kernel with support for the retbleed=unret mitigation.
 
 config CPU_IBPB_ENTRY
        bool "Enable IBPB on kernel entry"
-       depends on CPU_SUP_AMD
+       depends on CPU_SUP_AMD && X86_64
        default y
        help
          Compile the kernel with support for the retbleed=ibpb mitigation.
 
 config CPU_IBRS_ENTRY
        bool "Enable IBRS on kernel entry"
-       depends on CPU_SUP_INTEL
+       depends on CPU_SUP_INTEL && X86_64
        default y
        help
          Compile the kernel with support for the spectre_v2=ibrs mitigation.