lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date: Mon, 4 Mar 2024 16:15:07 +0800
From: LeoLiu-oc <LeoLiu-oc@...oxin.com>
To: <robin.murphy@....com>, <joro@...tes.org>, <will@...nel.org>,
	<iommu@...ts.linux.dev>, <linux-kernel@...r.kernel.org>
CC: <CobeChen@...oxin.com>, <TimGuo@...oxin.com>, <TonyWWang-oc@...oxin.com>,
	<YeeLi@...oxin.com>, <LeoLiu@...oxin.com>, leoliu-oc <leoliu-oc@...oxin.com>
Subject: [PATCH] iommu/dma: Fix not fully traversing iova reservations issue

From: leoliu-oc <leoliu-oc@...oxin.com>

For multiple devices in the same iommu group, sorted later device (based
on Bus:Dev.Func) have the RMRR.

Sorted earlier device (without RMRR) initialized the iova domain causing
the sorted later device goto done_unlock.

Then, the sorted later device (with RMRR) cannot execute the
iova_reserve_iommu_regions to reserve the RMRR in the group's iova domain,
and other devices (in the same group) alloc iova in RMRR are permitted.

DMA iova addresses conflict with RMRR in this case.

Goto iova_reserve_iommu_regions could avoid the problem (make sure all
devices of the same group execute reserve iova)

Signed-off-by: leoliu-oc <leoliu-oc@...oxin.com>
---
 drivers/iommu/dma-iommu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 50ccc4f1ef81..2b6c6bf4bccf 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -709,7 +709,7 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
 		}
 
 		ret = 0;
-		goto done_unlock;
+		goto iova_reserve;
 	}
 
 	init_iova_domain(iovad, 1UL << order, base_pfn);
@@ -724,6 +724,7 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
 	    (!device_iommu_capable(dev, IOMMU_CAP_DEFERRED_FLUSH) || iommu_dma_init_fq(domain)))
 		domain->type = IOMMU_DOMAIN_DMA;
 
+iova_reserve:
 	ret = iova_reserve_iommu_regions(dev, domain);
 
 done_unlock:
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ