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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250830130737.1930726-1-guanghuifeng@linux.alibaba.com>
Date: Sat, 30 Aug 2025 21:07:37 +0800
From: Guanghui Feng <guanghuifeng@...ux.alibaba.com>
To: dwmw2@...radead.org,
	baolu.lu@...ux.intel.com,
	joro@...tes.org,
	will@...nel.org,
	robin.murphy@....com
Cc: iommu@...ts.linux.dev,
	linux-kernel@...r.kernel.org,
	alikernel-developer@...ux.alibaba.com
Subject: [PATCH] iommu/vt-d: fix iommu pasid memory alloc & max pasid err

When intel_pasid_alloc_table allocates memory for Scalable Mode PASID
directories, the specified memory page order is incorrect, and an
additional PAGE_SHIFT is added. There is also an error in calculating
the maximum number of supported PASID directories. In the revised
implementation, 1 << (order + PASID_PDE_SHIFT - 3) represents the memory
occupied by the Scalable Mode PASID directory, divided by 8 to represent
the number of PASID directories, and then multiplied by the number of (1
<< PASID_PDE_SHIFT) entries in each PASID directory.

Signed-off-by: Guanghui Feng <guanghuifeng@...ux.alibaba.com>
---
 drivers/iommu/intel/pasid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c
index 52f678975da7..9969913b600b 100644
--- a/drivers/iommu/intel/pasid.c
+++ b/drivers/iommu/intel/pasid.c
@@ -61,14 +61,14 @@ int intel_pasid_alloc_table(struct device *dev)
 	size = max_pasid >> (PASID_PDE_SHIFT - 3);
 	order = size ? get_order(size) : 0;
 	dir = iommu_alloc_pages_node_sz(info->iommu->node, GFP_KERNEL,
-					1 << (order + PAGE_SHIFT));
+					1 << order);
 	if (!dir) {
 		kfree(pasid_table);
 		return -ENOMEM;
 	}
 
 	pasid_table->table = dir;
-	pasid_table->max_pasid = 1 << (order + PAGE_SHIFT + 3);
+	pasid_table->max_pasid = 1 << (order + PASID_PDE_SHIFT - 3);
 	info->pasid_table = pasid_table;
 
 	if (!ecap_coherent(info->iommu->ecap))
-- 
2.43.7


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ