Skip to content

Commit fb58fdc

Browse files
committed
iommu/vt-d: Do not enable ATS for untrusted devices
Currently Linux automatically enables ATS (Address Translation Service) for any device that supports it (and IOMMU is turned on). ATS is used to accelerate DMA access as the device can cache translations locally so there is no need to do full translation on IOMMU side. However, as pointed out in [1] ATS can be used to bypass IOMMU based security completely by simply sending PCIe read/write transaction with AT (Address Translation) field set to "translated". To mitigate this modify the Intel IOMMU code so that it does not enable ATS for any device that is marked as being untrusted. In case this turns out to cause performance issues we may selectively allow ATS based on user decision but currently use big hammer and disable it completely to be on the safe side. [1] https://www.repository.cam.ac.uk/handle/1810/274352 Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Ashok Raj <ashok.raj@intel.com> Reviewed-by: Joerg Roedel <jroedel@suse.de> Acked-by: Joerg Roedel <jroedel@suse.de>
1 parent 89a6079 commit fb58fdc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/iommu/intel-iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,8 @@ static void iommu_enable_dev_iotlb(struct device_domain_info *info)
14731473
if (info->pri_supported && !pci_reset_pri(pdev) && !pci_enable_pri(pdev, 32))
14741474
info->pri_enabled = 1;
14751475
#endif
1476-
if (info->ats_supported && !pci_enable_ats(pdev, VTD_PAGE_SHIFT)) {
1476+
if (!pdev->untrusted && info->ats_supported &&
1477+
!pci_enable_ats(pdev, VTD_PAGE_SHIFT)) {
14771478
info->ats_enabled = 1;
14781479
domain_update_iotlb(info->domain);
14791480
info->ats_qdep = pci_ats_queue_depth(pdev);

0 commit comments

Comments
 (0)