hw/i386/intel_iommu: Fix out-of-bounds access on guest IRT
PATCH 1/1 hw/i386/intel_iommu: Fix out-of-bounds access on guest IRT
From: Jan Kiszka <[email protected]>
vtd_irte_get failed to check the index against the configured table size, causing an out-of-bounds access on guest memory and potentially misinterpreting the result.
---
BTW, we still miss error reporting emulation, right? Therefore, I added that simple error_report_once thing, like the other paths do.
hw/i386/intel_iommu.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/i386/intel_iommu.c +6 -0
@@ -3094,6 +3094,12 @@ static int vtd_irte_get(IntelIOMMUState *iommu, uint16_t index,uint16_t mask, source_id;uint8_t bus, bus_max, bus_min; +if (index >= iommu->intr_size) { +error_report_once ("%s: index too large: ind=0x%x" , + __func__, index); +return -VTD_FR_IR_INDEX_OVER ; + } + addr = iommu->intr_root + index *sizeof (*entry);if (dma_memory_read (&address_space_memory, addr, entry,sizeof (*entry))) {
Signature · 6 lines
2.16.4 -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Paolo Bonzini
AppliedQuoted 23 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
vtd_irte_getfailed to check the index against the configured table size, causing an out-of-bounds access on guest memory and potentially misinterpreting the result.Signed-off-by Jan Kiszka <[email protected]>---
BTW, we still miss error reporting emulation, right? Therefore, I added that simple
error_report_oncething, like the other paths do.hw/i386/intel_iommu.c | 6 ++++++ 1 file changed, 6 insertions(+)hw/i386/intel_iommu.c +0
-0@@ -3094,6 +3094,12 @@ static int vtd_irte_get(IntelIOMMUState *iommu, uint16_t index,uint16_t mask, source_id;uint8_t bus, bus_max, bus_min;
hw/i386/intel_iommu.c static int vtd_irte_get(IntelIOMMUState *iommu, uint16_t index, · line 3105
Quoted 10 lines
hw/i386/intel_iommu.c +6
-0+if (index >= iommu->intr_size) { +error_report_once ("%s: index too large: ind=0x%x" , + __func__, index); +return -VTD_FR_IR_INDEX_OVER ; + } + addr = iommu->intr_root + index *sizeof (*entry);if (dma_memory_read (&address_space_memory, addr, entry,sizeof (*entry))) {
Queued, thanks.
Paolo
Quoted 7 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
vtd_irte_getfailed to check the index against the configured table size, causing an out-of-bounds access on guest memory and potentially misinterpreting the result.Signed-off-by Jan Kiszka <[email protected]>
Quoted 4 lines
---
BTW, we still miss error reporting emulation, right? Therefore, I added that simple
error_report_oncething, like the other paths do.
Yes...
Thanks,
Signature · 1 line
Peter Xu