linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/4] PCI / iommu / thunderbolt: IOMMU based DMA protection
@ 2018-11-29 15:51 Mika Westerberg
  2018-11-29 15:51 ` [PATCH v3 1/4] PCI / ACPI: Identify untrusted PCI devices Mika Westerberg
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Mika Westerberg @ 2018-11-29 15:51 UTC (permalink / raw)
  To: iommu
  Cc: Joerg Roedel, David Woodhouse, Lu Baolu, Ashok Raj,
	Bjorn Helgaas, Rafael J. Wysocki, Jacob jun Pan, Andreas Noever,
	Michael Jamet, Yehezkel Bernat, Lukas Wunner, Christian Kellner,
	Mario.Limonciello, Anthony Wong, Lorenzo Pieralisi,
	Christoph Hellwig, Alex Williamson, Mika Westerberg, linux-acpi,
	linux-pci, linux-kernel

Recent systems with Thunderbolt ports may be utilizing IOMMU to prevent DMA
attacks. This is different from the previous security level based scheme
because the connected device cannot access system memory outside of the
regions allocated for it by the driver.

When enabled the BIOS makes sure no device can do DMA outside of RMRR
(Reserved Memory Region Record) regions. This means that during OS boot,
before it enables IOMMU, none of the connected devices can bypass DMA
protection for instance by overwriting the data structures used by the
IOMMU. The BIOS communicates support for this to the OS by setting a new
bit in ACPI DMAR table [1].

Because these systems utilize an IOMMU to block possible DMA attacks,
typically (but not always) the Thunderbolt security level is set to "none"
which means that all PCIe devices are immediately usable. This also means
that Linux needs to follow Windows 10 and enable IOMMU automatically when
running on such system otherwise connected devices can read/write system
memory pretty much without any restrictions.

Since there is a way to identify PCIe root ports that are "external facing"
we can put all internal devices to pass through (identity mapping) mode and
only external devices need to go through full IOMMU mappings. We add a new
flag "untrusted" that is supposed to cover various PCIe devices that may be
used to conduct DMA attacks.

We also make sure PCIe ATS (Address Translation Service) is not enabled for
devices flagged as untrusted because it could be used to bypass IOMMU
completely as explained in the changelog of patch 3/4.

Finally we expose this information to userspace so tools such as bolt can
do more accurate decision whether or not authorize the connected device.

[1] https://software.intel.com/sites/default/files/managed/c5/15/vt-directed-io-spec.pdf

Previous version of the patch series can be found here:

  v2: https://lkml.org/lkml/2018/11/26/638
  v1: https://www.spinics.net/lists/linux-pci/msg77751.html

Changes from v2:
  
  * Rename the flag to "untrusted"
  * Simplify setting the flag for root ports
  * Dropped loop in set_pcie_untrusted()
  * Add comment on top of prp_guids explaining the possible caveat
    resulting when the new GUIDs are treated as equivalent
  * Updated changelogs according to feedback

Changes from v1:

  * Reword Documentation/admin-guide/thunderbolt.rst to make the feature
    time frame/platform oriented as there will be systems shipping
    with Linux installed by default.

  * Rename the flag is_external to is_untrusted so that we could use the
    same flag to cover all kinds of "untrusted" PCI devices, not just
    Thunderbolt connected devices. I still parse the _DSD in PCI/ACPI core
    because that's where we currently handle "HotPlugSupportInD3" as well.
    Also updated comments in patch [1/4].

  * Added tags from Ashok, Joerg and Yehezkel. I'm assuming they still
    apply because I did not change the code with the exception of few
    comments and rename of the flag. Let me know if that's not the case
    anymore.

Lu Baolu (1):
  iommu/vt-d: Force IOMMU on for platform opt in hint

Mika Westerberg (3):
  PCI / ACPI: Identify untrusted PCI devices
  iommu/vt-d: Do not enable ATS for untrusted devices
  thunderbolt: Export IOMMU based DMA protection support to userspace

 .../ABI/testing/sysfs-bus-thunderbolt         |  9 +++
 Documentation/admin-guide/thunderbolt.rst     | 20 +++++++
 drivers/acpi/property.c                       | 11 ++++
 drivers/iommu/dmar.c                          | 25 +++++++++
 drivers/iommu/intel-iommu.c                   | 56 ++++++++++++++++++-
 drivers/pci/pci-acpi.c                        | 19 +++++++
 drivers/pci/probe.c                           | 15 +++++
 drivers/thunderbolt/domain.c                  | 17 ++++++
 include/linux/dmar.h                          |  8 +++
 include/linux/pci.h                           |  8 +++
 10 files changed, 185 insertions(+), 3 deletions(-)

-- 
2.19.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-12-05  9:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 15:51 [PATCH v3 0/4] PCI / iommu / thunderbolt: IOMMU based DMA protection Mika Westerberg
2018-11-29 15:51 ` [PATCH v3 1/4] PCI / ACPI: Identify untrusted PCI devices Mika Westerberg
2018-11-29 20:59   ` Rafael J. Wysocki
2018-12-04  0:28   ` Bjorn Helgaas
2018-12-04  8:57     ` Mika Westerberg
2018-11-29 15:51 ` [PATCH v3 2/4] iommu/vt-d: Force IOMMU on for platform opt in hint Mika Westerberg
2018-11-29 15:51 ` [PATCH v3 3/4] iommu/vt-d: Do not enable ATS for untrusted devices Mika Westerberg
2018-11-29 15:51 ` [PATCH v3 4/4] thunderbolt: Export IOMMU based DMA protection support to userspace Mika Westerberg
2018-12-05  9:11 ` [PATCH v3 0/4] PCI / iommu / thunderbolt: IOMMU based DMA protection Mika Westerberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).