Commit aec147c1 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'x86-urgent-2024-04-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:

 - Make the CPU_MITIGATIONS=n interaction with conflicting
   mitigation-enabling boot parameters a bit saner.

 - Re-enable CPU mitigations by default on non-x86

 - Fix TDX shared bit propagation on mprotect()

 - Fix potential show_regs() system hang when PKE initialization
   is not fully finished yet.

 - Add the 0x10-0x1f model IDs to the Zen5 range

 - Harden #VC instruction emulation some more

* tag 'x86-urgent-2024-04-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  cpu: Ignore "mitigations" kernel parameter if CPU_MITIGATIONS=n
  cpu: Re-enable CPU mitigations by default for !X86 architectures
  x86/tdx: Preserve shared bit on mprotect()
  x86/cpu: Fix check for RDPKRU in __show_regs()
  x86/CPU/AMD: Add models 0x10-0x1f to the Zen5 range
  x86/sev: Check for MWAITX and MONITORX opcodes in the #VC handler
parents 8d62e9bf ce0abef6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3423,6 +3423,9 @@
			arch-independent options, each of which is an
			aggregation of existing arch-specific options.

			Note, "mitigations" is supported if and only if the
			kernel was built with CPU_MITIGATIONS=y.

			off
				Disable all optional CPU mitigations.  This
				improves system performance, but it may also
+8 −0
Original line number Diff line number Diff line
@@ -9,6 +9,14 @@
#
source "arch/$(SRCARCH)/Kconfig"

config ARCH_CONFIGURES_CPU_MITIGATIONS
	bool

if !ARCH_CONFIGURES_CPU_MITIGATIONS
config CPU_MITIGATIONS
	def_bool y
endif

menu "General architecture-dependent options"

config ARCH_HAS_SUBPAGE_FAULTS
+12 −7
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ config X86
	select ACPI_HOTPLUG_CPU			if ACPI_PROCESSOR && HOTPLUG_CPU
	select ARCH_32BIT_OFF_T			if X86_32
	select ARCH_CLOCKSOURCE_INIT
	select ARCH_CONFIGURES_CPU_MITIGATIONS
	select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
	select ARCH_ENABLE_HUGEPAGE_MIGRATION if X86_64 && HUGETLB_PAGE && MIGRATION
	select ARCH_ENABLE_MEMORY_HOTPLUG if X86_64
@@ -2488,17 +2489,21 @@ config PREFIX_SYMBOLS
	def_bool y
	depends on CALL_PADDING && !CFI_CLANG

menuconfig SPECULATION_MITIGATIONS
	bool "Mitigations for speculative execution vulnerabilities"
menuconfig CPU_MITIGATIONS
	bool "Mitigations for CPU vulnerabilities"
	default y
	help
	  Say Y here to enable options which enable mitigations for
	  speculative execution hardware vulnerabilities.
	  Say Y here to enable options which enable mitigations for hardware
	  vulnerabilities (usually related to speculative execution).
	  Mitigations can be disabled or restricted to SMT systems at runtime
	  via the "mitigations" kernel parameter.

	  If you say N, all mitigations will be disabled. You really
	  should know what you are doing to say so.
	  If you say N, all mitigations will be disabled.  This CANNOT be
	  overridden at runtime.

if SPECULATION_MITIGATIONS
	  Say 'Y', unless you really know what you are doing.

if CPU_MITIGATIONS

config MITIGATION_PAGE_TABLE_ISOLATION
	bool "Remove the kernel mapping in user mode"
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ u64 cc_mkdec(u64 val);
void cc_random_init(void);
#else
#define cc_vendor (CC_VENDOR_NONE)
static const u64 cc_mask = 0;

static inline u64 cc_mkenc(u64 val)
{
+2 −1
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@
#define _COMMON_PAGE_CHG_MASK	(PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT |	\
				 _PAGE_SPECIAL | _PAGE_ACCESSED |	\
				 _PAGE_DIRTY_BITS | _PAGE_SOFT_DIRTY |	\
				 _PAGE_DEVMAP | _PAGE_ENC | _PAGE_UFFD_WP)
				 _PAGE_DEVMAP | _PAGE_CC | _PAGE_UFFD_WP)
#define _PAGE_CHG_MASK	(_COMMON_PAGE_CHG_MASK | _PAGE_PAT)
#define _HPAGE_CHG_MASK (_COMMON_PAGE_CHG_MASK | _PAGE_PSE | _PAGE_PAT_LARGE)

@@ -173,6 +173,7 @@ enum page_cache_mode {
};
#endif

#define _PAGE_CC		(_AT(pteval_t, cc_mask))
#define _PAGE_ENC		(_AT(pteval_t, sme_me_mask))

#define _PAGE_CACHE_MASK	(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)
Loading