Merge branch 'amd-iommu-fix'

Merge AMD iommu fix from Jörg Rödel:
 "Improper validation of device table accesses in the IOMMU may allow an
  out-of-bounds read of a Device Table Entry (DTE), potentially
  resulting in loss of system integrity or denial of service.

  This issue does not manifest when the device table is configured to
  its maximum supported size (Suravee Suthikulpanit)"

* amd-iommu-fix:
  iommu/amd: Force device table to maximum size
This commit is contained in:
Linus Torvalds
2026-11-10 08:03:44 -08:00
+24 -3
View File
@@ -1752,6 +1752,21 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
return 0;
}
/*
* Apply workaround for Zen1 to Zen5(BRH) generation of processors.
* References: CVE-2024-21963
*/
static bool __init amd_iommu_force_max_dev_table(void)
{
if (boot_cpu_data.x86 >= 0x17 && boot_cpu_data.x86 <= 0x1a) {
if (cpu_feature_enabled(X86_FEATURE_ZEN6))
return false;
else
return true;
}
return false;
}
/* Allocate PCI segment data structure */
static struct amd_iommu_pci_seg *__init alloc_pci_segment(u16 id,
struct acpi_table_header *ivrs_base)
@@ -1774,9 +1789,15 @@ static struct amd_iommu_pci_seg *__init alloc_pci_segment(u16 id,
pci_seg->last_bdf = last_bdf;
DUMP_printk("PCI segment : 0x%0x, last bdf : 0x%04x\n", id, last_bdf);
pci_seg->dev_table_size =
max(roundup_pow_of_two((last_bdf + 1) * DEV_TABLE_ENTRY_SIZE),
SZ_4K);
if (amd_iommu_force_max_dev_table()) {
pr_info("Force device table to maximum size\n");
pci_seg->dev_table_size = SZ_2M;
} else {
pci_seg->dev_table_size =
max(roundup_pow_of_two((last_bdf + 1) *
DEV_TABLE_ENTRY_SIZE),
SZ_4K);
}
pci_seg->id = id;
init_llist_head(&pci_seg->dev_data_list);