Skip to content

Commit ce4cc52

Browse files
Barret Rhodenjoergroedel
authored andcommitted
iommu/vt-d: Add RMRR base and end addresses sanity check
The VT-d spec specifies requirements for the RMRR entries base and end (called 'Limit' in the docs) addresses. This commit will cause the DMAR processing to mark the firmware as tainted if any RMRR entries that do not meet these requirements. Signed-off-by: Barret Rhoden <[email protected]> Signed-off-by: Lu Baolu <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent f5a68bb commit ce4cc52

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/iommu/intel-iommu.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4454,13 +4454,24 @@ static void __init init_iommu_pm_ops(void)
44544454
static inline void init_iommu_pm_ops(void) {}
44554455
#endif /* CONFIG_PM */
44564456

4457+
static int rmrr_sanity_check(struct acpi_dmar_reserved_memory *rmrr)
4458+
{
4459+
if (!IS_ALIGNED(rmrr->base_address, PAGE_SIZE) ||
4460+
!IS_ALIGNED(rmrr->end_address + 1, PAGE_SIZE) ||
4461+
rmrr->end_address <= rmrr->base_address ||
4462+
arch_rmrr_sanity_check(rmrr))
4463+
return -EINVAL;
4464+
4465+
return 0;
4466+
}
4467+
44574468
int __init dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg)
44584469
{
44594470
struct acpi_dmar_reserved_memory *rmrr;
44604471
struct dmar_rmrr_unit *rmrru;
44614472

44624473
rmrr = (struct acpi_dmar_reserved_memory *)header;
4463-
if (arch_rmrr_sanity_check(rmrr))
4474+
if (rmrr_sanity_check(rmrr))
44644475
WARN_TAINT(1, TAINT_FIRMWARE_WORKAROUND,
44654476
"Your BIOS is broken; bad RMRR [%#018Lx-%#018Lx]\n"
44664477
"BIOS vendor: %s; Ver: %s; Product Version: %s\n",

0 commit comments

Comments
 (0)