Skip to contentSkip to conversation

AMD/IOMMU: Fix crash in 'V' debugkey

PATCH In review Andrew Cooper 3 participants 4 messages Nov 13, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 AMD/IOMMU: Fix crash in 'V' debugkey

c/s bb038f31168 "AMD/IOMMU: replace INTREMAP_ENTRIES" introduces a call to intremap_table_entries() in dump_intremap_table() before tbl.ptr is checked for NULL.

intremap_table_entries() internally uses virt_to_page() which falls over

  ASSERT(va >= XEN_VIRT_START);

in __virt_to_page().

---
CC: Jan Beulich <[email protected]>
CC: Juergen Gross <[email protected]>

For 4.13. Regression vs 4.12

---
 xen/drivers/passthrough/amd/iommu_intr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
xen/drivers/passthrough/amd/iommu_intr.c +3 -1
index 1eed60f265..5e92c023f8 100644
@@ -847,11 +847,13 @@ static void dump_intremap_table(const struct amd_iommu *iommu,
                                 union irte_cptr tbl,
                                 const struct ivrs_mappings *ivrs_mapping)
 {
-    unsigned int count, nr = intremap_table_entries(tbl.ptr, iommu);
+    unsigned int count, nr;
 
     if ( !tbl.ptr )
         return;
 
+    nr = intremap_table_entries(tbl.ptr, iommu);
+
     for ( count = 0; count < nr; count++ )
     {
         if ( iommu->ctrl.ga_en
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 8 lines · Andrew Cooper

c/s bb038f31168 "AMD/IOMMU: replace INTREMAP_ENTRIES" introduces a call to intremap_table_entries() in dump_intremap_table() before tbl.ptr is checked for NULL.

intremap_table_entries() internally uses virt_to_page() which falls over

  ASSERT(va >= XEN_VIRT_START);
Quoted 8 lines

in __virt_to_page().

---
CC: Jan Beulich <[email protected]>
CC: Juergen Gross <[email protected]>

For 4.13. Regression vs 4.12

Oops sorry.  Should have had a Reported-by: Igor Druzhinin <[email protected]>

Fixed up locally

~Andrew

Quoted 13 lines
---
 xen/drivers/passthrough/amd/iommu_intr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
xen/drivers/passthrough/amd/iommu_intr.c +0 -1
index 1eed60f265..5e92c023f8 100644
@@ -847,11 +847,13 @@ static void dump_intremap_table(const struct amd_iommu *iommu,
                                 union irte_cptr tbl,
                                 const struct ivrs_mappings *ivrs_mapping)
 {
-    unsigned int count, nr = intremap_table_entries(tbl.ptr, iommu);

xen/drivers/passthrough/amd/iommu_intr.c static void dump_intremap_table(const struct amd_iommu *iommu, · line 859

Quoted 10 lines
xen/drivers/passthrough/amd/iommu_intr.c +3 -0
+    unsigned int count, nr;
 
     if ( !tbl.ptr )
         return;
 
+    nr = intremap_table_entries(tbl.ptr, iommu);
+
     for ( count = 0; count < nr; count++ )
     {
         if ( iommu->ctrl.ga_en

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Andrew Cooper
Quoted 11 lines · Andrew Cooper

c/s bb038f31168 "AMD/IOMMU: replace INTREMAP_ENTRIES" introduces a call to intremap_table_entries() in dump_intremap_table() before tbl.ptr is checked for NULL.

intremap_table_entries() internally uses virt_to_page() which falls over

  ASSERT(va >= XEN_VIRT_START);

in __virt_to_page().

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
In reply to Andrew Cooper
Quoted 11 lines · Andrew Cooper

c/s bb038f31168 "AMD/IOMMU: replace INTREMAP_ENTRIES" introduces a call to intremap_table_entries() in dump_intremap_table() before tbl.ptr is checked for NULL.

intremap_table_entries() internally uses virt_to_page() which falls over

   ASSERT(va >= XEN_VIRT_START);

in __virt_to_page().

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel