]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
x86: Filter out physical address that can't be handled by DMAR units
authorJan Kiszka <jan.kiszka@siemens.com>
Wed, 24 Feb 2016 09:19:54 +0000 (10:19 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Mon, 7 Mar 2016 12:49:05 +0000 (13:49 +0100)
Make sure that we do not try to program DMAR page tables with physical
addresses beyond the supported range (39 or 48 bits, depending on the
page table levels).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/arch/x86/vtd.c

index 28faf51a374831cd6ed7863a46b9ccfa24c5875e..6d36394c8196dd188cb3cc9469565579aa0d24fb 100644 (file)
@@ -773,6 +773,9 @@ int iommu_map_memory_region(struct cell *cell,
        if (!(mem->flags & JAILHOUSE_MEM_DMA))
                return 0;
 
+       if (mem->virt_start & BIT_MASK(63, 12 + 9 * dmar_pt_levels))
+               return trace_error(-E2BIG);
+
        if (mem->flags & JAILHOUSE_MEM_READ)
                flags |= VTD_PAGE_READ;
        if (mem->flags & JAILHOUSE_MEM_WRITE)