Merge tag 'x86_build_for_v6.0_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Aug 2022 17:14:19 +0000 (10:14 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Aug 2022 17:14:19 +0000 (10:14 -0700)
Pull x86 build updates from Borislav Petkov:

 - Fix stack protector builds when cross compiling with Clang

 - Other Kbuild improvements and fixes

* tag 'x86_build_for_v6.0_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/purgatory: Omit use of bin2c
  x86/purgatory: Hard-code obj-y in Makefile
  x86/build: Remove unused OBJECT_FILES_NON_STANDARD_test_nx.o
  x86/Kconfig: Fix CONFIG_CC_HAS_SANE_STACKPROTECTOR when cross compiling with clang

1  2 
arch/x86/Kconfig

diff --combined arch/x86/Kconfig
@@@ -245,7 -245,6 +245,7 @@@ config X8
        select HAVE_PERF_REGS
        select HAVE_PERF_USER_STACK_DUMP
        select MMU_GATHER_RCU_TABLE_FREE        if PARAVIRT
 +      select MMU_GATHER_MERGE_VMAS
        select HAVE_POSIX_CPU_TIMERS_TASK_WORK
        select HAVE_REGS_AND_STACK_ACCESS_API
        select HAVE_RELIABLE_STACKTRACE         if UNWINDER_ORC || STACK_VALIDATION
@@@ -392,8 -391,8 +392,8 @@@ config PGTABLE_LEVEL
  
  config CC_HAS_SANE_STACKPROTECTOR
        bool
-       default $(success,$(srctree)/scripts/gcc-x86_64-has-stack-protector.sh $(CC)) if 64BIT
-       default $(success,$(srctree)/scripts/gcc-x86_32-has-stack-protector.sh $(CC))
+       default $(success,$(srctree)/scripts/gcc-x86_64-has-stack-protector.sh $(CC) $(CLANG_FLAGS)) if 64BIT
+       default $(success,$(srctree)/scripts/gcc-x86_32-has-stack-protector.sh $(CC) $(CLANG_FLAGS))
        help
          We have to make sure stack protector is unconditionally disabled if
          the compiler produces broken code or if it does not let us control
@@@ -463,6 -462,29 +463,6 @@@ config GOLDFIS
        def_bool y
        depends on X86_GOLDFISH
  
 -config RETPOLINE
 -      bool "Avoid speculative indirect branches in kernel"
 -      select OBJTOOL if HAVE_OBJTOOL
 -      default y
 -      help
 -        Compile kernel with the retpoline compiler options to guard against
 -        kernel-to-user data leaks by avoiding speculative indirect
 -        branches. Requires a compiler with -mindirect-branch=thunk-extern
 -        support for full protection. The kernel may run slower.
 -
 -config CC_HAS_SLS
 -      def_bool $(cc-option,-mharden-sls=all)
 -
 -config SLS
 -      bool "Mitigate Straight-Line-Speculation"
 -      depends on CC_HAS_SLS && X86_64
 -      select OBJTOOL if HAVE_OBJTOOL
 -      default n
 -      help
 -        Compile the kernel with straight-line-speculation options to guard
 -        against straight line speculation. The kernel image might be slightly
 -        larger.
 -
  config X86_CPU_RESCTRL
        bool "x86 CPU resource control support"
        depends on X86 && (CPU_SUP_INTEL || CPU_SUP_AMD)
@@@ -2010,7 -2032,6 +2010,6 @@@ config KEXE
  config KEXEC_FILE
        bool "kexec file based system call"
        select KEXEC_CORE
-       select BUILD_BIN2C
        depends on X86_64
        depends on CRYPTO=y
        depends on CRYPTO_SHA256=y
@@@ -2431,91 -2452,6 +2430,91 @@@ source "kernel/livepatch/Kconfig
  
  endmenu
  
 +config CC_HAS_SLS
 +      def_bool $(cc-option,-mharden-sls=all)
 +
 +config CC_HAS_RETURN_THUNK
 +      def_bool $(cc-option,-mfunction-return=thunk-extern)
 +
 +menuconfig SPECULATION_MITIGATIONS
 +      bool "Mitigations for speculative execution vulnerabilities"
 +      default y
 +      help
 +        Say Y here to enable options which enable mitigations for
 +        speculative execution hardware vulnerabilities.
 +
 +        If you say N, all mitigations will be disabled. You really
 +        should know what you are doing to say so.
 +
 +if SPECULATION_MITIGATIONS
 +
 +config PAGE_TABLE_ISOLATION
 +      bool "Remove the kernel mapping in user mode"
 +      default y
 +      depends on (X86_64 || X86_PAE)
 +      help
 +        This feature reduces the number of hardware side channels by
 +        ensuring that the majority of kernel addresses are not mapped
 +        into userspace.
 +
 +        See Documentation/x86/pti.rst for more details.
 +
 +config RETPOLINE
 +      bool "Avoid speculative indirect branches in kernel"
 +      select OBJTOOL if HAVE_OBJTOOL
 +      default y
 +      help
 +        Compile kernel with the retpoline compiler options to guard against
 +        kernel-to-user data leaks by avoiding speculative indirect
 +        branches. Requires a compiler with -mindirect-branch=thunk-extern
 +        support for full protection. The kernel may run slower.
 +
 +config RETHUNK
 +      bool "Enable return-thunks"
 +      depends on RETPOLINE && CC_HAS_RETURN_THUNK
 +      select OBJTOOL if HAVE_OBJTOOL
 +      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.
 +        Requires a compiler with -mfunction-return=thunk-extern
 +        support for full protection. The kernel may run slower.
 +
 +config CPU_UNRET_ENTRY
 +      bool "Enable UNRET on kernel entry"
 +      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 && 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 && X86_64
 +      default y
 +      help
 +        Compile the kernel with support for the spectre_v2=ibrs mitigation.
 +        This mitigates both spectre_v2 and retbleed at great cost to
 +        performance.
 +
 +config SLS
 +      bool "Mitigate Straight-Line-Speculation"
 +      depends on CC_HAS_SLS && X86_64
 +      select OBJTOOL if HAVE_OBJTOOL
 +      default n
 +      help
 +        Compile the kernel with straight-line-speculation options to guard
 +        against straight line speculation. The kernel image might be slightly
 +        larger.
 +
 +endif
 +
  config ARCH_HAS_ADD_PAGES
        def_bool y
        depends on ARCH_ENABLE_MEMORY_HOTPLUG