Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 958f338e authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Merge L1 Terminal Fault fixes from Thomas Gleixner:
 "L1TF, aka L1 Terminal Fault, is yet another speculative hardware
  engineering trainwreck. It's a hardware vulnerability which allows
  unprivileged speculative access to data which is available in the
  Level 1 Data Cache when the page table entry controlling the virtual
  address, which is used for the access, has the Present bit cleared or
  other reserved bits set.

  If an instruction accesses a virtual address for which the relevant
  page table entry (PTE) has the Present bit cleared or other reserved
  bits set, then speculative execution ignores the invalid PTE and loads
  the referenced data if it is present in the Level 1 Data Cache, as if
  the page referenced by the address bits in the PTE was still present
  and accessible.

  While this is a purely speculative mechanism and the instruction will
  raise a page fault when it is retired eventually, the pure act of
  loading the data and making it available to other speculative
  instructions opens up the opportunity for side channel attacks to
  unprivileged malicious code, similar to the Meltdown attack.

  While Meltdown breaks the user space to kernel space protection, L1TF
  allows to attack any physical memory address in the system and the
  attack works across all protection domains. It allows an attack of SGX
  and also works from inside virtual machines because the speculation
  bypasses the extended page table (EPT) protection mechanism.

  The assoicated CVEs are: CVE-2018-3615, CVE-2018-3620, CVE-2018-3646

  The mitigations provided by this pull request include:

   - Host side protection by inverting the upper address bits of a non
     present page table entry so the entry points to uncacheable memory.

   - Hypervisor protection by flushing L1 Data Cache on VMENTER.

   - SMT (HyperThreading) control knobs, which allow to 'turn off' SMT
     by offlining the sibling CPU threads. The knobs are available on
     the kernel command line and at runtime via sysfs

   - Control knobs for the hypervisor mitigation, related to L1D flush
     and SMT control. The knobs are available on the kernel command line
     and at runtime via sysfs

   - Extensive documentation about L1TF including various degrees of
     mitigations.

  Thanks to all people who have contributed to this in various ways -
  patches, review, testing, backporting - and the fruitful, sometimes
  heated, but at the end constructive discussions.

  There is work in progress to provide other forms of mitigations, which
  might be less horrible performance wise for a particular kind of
  workloads, but this is not yet ready for consumption due to their
  complexity and limitations"

* 'l1tf-final' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (75 commits)
  x86/microcode: Allow late microcode loading with SMT disabled
  tools headers: Synchronise x86 cpufeatures.h for L1TF additions
  x86/mm/kmmio: Make the tracer robust against L1TF
  x86/mm/pat: Make set_memory_np() L1TF safe
  x86/speculation/l1tf: Make pmd/pud_mknotpresent() invert
  x86/speculation/l1tf: Invert all not present mappings
  cpu/hotplug: Fix SMT supported evaluation
  KVM: VMX: Tell the nested hypervisor to skip L1D flush on vmentry
  x86/speculation: Use ARCH_CAPABILITIES to skip L1D flush on vmentry
  x86/speculation: Simplify sysfs report of VMX L1TF vulnerability
  Documentation/l1tf: Remove Yonah processors from not vulnerable list
  x86/KVM/VMX: Don't set l1tf_flush_l1d from vmx_handle_external_intr()
  x86/irq: Let interrupt handlers set kvm_cpu_l1tf_flush_l1d
  x86: Don't include linux/irq.h from asm/hardirq.h
  x86/KVM/VMX: Introduce per-host-cpu analogue of l1tf_flush_l1d
  x86/irq: Demote irq_cpustat_t::__softirq_pending to u16
  x86/KVM/VMX: Move the l1tf_flush_l1d test to vmx_l1d_flush()
  x86/KVM/VMX: Replace 'vmx_l1d_flush_always' with 'vmx_l1d_flush_cond'
  x86/KVM/VMX: Don't set l1tf_flush_l1d to true from vmx_l1d_flush()
  cpu/hotplug: detect SMT disabled by BIOS
  ...
parents 781fca5b 07d981ad
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -476,6 +476,7 @@ What: /sys/devices/system/cpu/vulnerabilities
		/sys/devices/system/cpu/vulnerabilities/spectre_v1
		/sys/devices/system/cpu/vulnerabilities/spectre_v2
		/sys/devices/system/cpu/vulnerabilities/spec_store_bypass
		/sys/devices/system/cpu/vulnerabilities/l1tf
Date:		January 2018
Contact:	Linux kernel mailing list <linux-kernel@vger.kernel.org>
Description:	Information about CPU vulnerabilities
@@ -487,3 +488,26 @@ Description: Information about CPU vulnerabilities
		"Not affected"	  CPU is not affected by the vulnerability
		"Vulnerable"	  CPU is affected and no mitigation in effect
		"Mitigation: $M"  CPU is affected and mitigation $M is in effect

		Details about the l1tf file can be found in
		Documentation/admin-guide/l1tf.rst

What:		/sys/devices/system/cpu/smt
		/sys/devices/system/cpu/smt/active
		/sys/devices/system/cpu/smt/control
Date:		June 2018
Contact:	Linux kernel mailing list <linux-kernel@vger.kernel.org>
Description:	Control Symetric Multi Threading (SMT)

		active:  Tells whether SMT is active (enabled and siblings online)

		control: Read/write interface to control SMT. Possible
			 values:

			 "on"		SMT is enabled
			 "off"		SMT is disabled
			 "forceoff"	SMT is force disabled. Cannot be changed.
			 "notsupported" SMT is not supported by the CPU

			 If control status is "forceoff" or "notsupported" writes
			 are rejected.
+9 −0
Original line number Diff line number Diff line
@@ -17,6 +17,15 @@ etc.
   kernel-parameters
   devices

This section describes CPU vulnerabilities and provides an overview of the
possible mitigations along with guidance for selecting mitigations if they
are configurable at compile, boot or run time.

.. toctree::
   :maxdepth: 1

   l1tf

Here is a set of documents aimed at users who are trying to track down
problems and bugs in particular.

+78 −0
Original line number Diff line number Diff line
@@ -1967,10 +1967,84 @@
			(virtualized real and unpaged mode) on capable
			Intel chips. Default is 1 (enabled)

	kvm-intel.vmentry_l1d_flush=[KVM,Intel] Mitigation for L1 Terminal Fault
			CVE-2018-3620.

			Valid arguments: never, cond, always

			always: L1D cache flush on every VMENTER.
			cond:	Flush L1D on VMENTER only when the code between
				VMEXIT and VMENTER can leak host memory.
			never:	Disables the mitigation

			Default is cond (do L1 cache flush in specific instances)

	kvm-intel.vpid=	[KVM,Intel] Disable Virtual Processor Identification
			feature (tagged TLBs) on capable Intel chips.
			Default is 1 (enabled)

	l1tf=           [X86] Control mitigation of the L1TF vulnerability on
			      affected CPUs

			The kernel PTE inversion protection is unconditionally
			enabled and cannot be disabled.

			full
				Provides all available mitigations for the
				L1TF vulnerability. Disables SMT and
				enables all mitigations in the
				hypervisors, i.e. unconditional L1D flush.

				SMT control and L1D flush control via the
				sysfs interface is still possible after
				boot.  Hypervisors will issue a warning
				when the first VM is started in a
				potentially insecure configuration,
				i.e. SMT enabled or L1D flush disabled.

			full,force
				Same as 'full', but disables SMT and L1D
				flush runtime control. Implies the
				'nosmt=force' command line option.
				(i.e. sysfs control of SMT is disabled.)

			flush
				Leaves SMT enabled and enables the default
				hypervisor mitigation, i.e. conditional
				L1D flush.

				SMT control and L1D flush control via the
				sysfs interface is still possible after
				boot.  Hypervisors will issue a warning
				when the first VM is started in a
				potentially insecure configuration,
				i.e. SMT enabled or L1D flush disabled.

			flush,nosmt

				Disables SMT and enables the default
				hypervisor mitigation.

				SMT control and L1D flush control via the
				sysfs interface is still possible after
				boot.  Hypervisors will issue a warning
				when the first VM is started in a
				potentially insecure configuration,
				i.e. SMT enabled or L1D flush disabled.

			flush,nowarn
				Same as 'flush', but hypervisors will not
				warn when a VM is started in a potentially
				insecure configuration.

			off
				Disables hypervisor mitigations and doesn't
				emit any warnings.

			Default is 'flush'.

			For details see: Documentation/admin-guide/l1tf.rst

	l2cr=		[PPC]

	l3cr=		[PPC]
@@ -2687,6 +2761,10 @@
	nosmt		[KNL,S390] Disable symmetric multithreading (SMT).
			Equivalent to smt=1.

			[KNL,x86] Disable symmetric multithreading (SMT).
			nosmt=force: Force disable SMT, cannot be undone
				     via the sysfs control file.

	nospectre_v2	[X86] Disable all mitigations for the Spectre variant 2
			(indirect branch prediction) vulnerability. System may
			allow data leaks with this option, which is equivalent
+610 −0

File added.

Preview size limit exceeded, changes collapsed.

+3 −0
Original line number Diff line number Diff line
@@ -13,6 +13,9 @@ config KEXEC_CORE
config HAVE_IMA_KEXEC
	bool

config HOTPLUG_SMT
	bool

config OPROFILE
	tristate "OProfile system profiling"
	depends on PROFILING
Loading