WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] VT-d: avoid faulting in print_iommu_regs()

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] VT-d: avoid faulting in print_iommu_regs()
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Tue, 23 Mar 2010 16:56:54 +0000
Delivery-date: Tue, 23 Mar 2010 09:59:16 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
In c/s 21027 I overlooked that using this function when bad table data
was found requires the function to also do some range checking.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- 2010-03-22.orig/xen/drivers/passthrough/vtd/utils.c 2010-03-17 
22:19:25.000000000 +0100
+++ 2010-03-22/xen/drivers/passthrough/vtd/utils.c      2010-03-23 
17:52:20.000000000 +0100
@@ -67,10 +67,13 @@ void print_iommu_regs(struct acpi_drhd_u
     printk(" CAP = %"PRIx64"\n", cap = dmar_readq(iommu->reg, DMAR_CAP_REG));
     printk(" n_fault_reg = %"PRIx64"\n", cap_num_fault_regs(cap));
     printk(" fault_recording_offset = %"PRIx64"\n", cap_fault_reg_offset(cap));
-    printk(" fault_recording_reg_l = %"PRIx64"\n",
-           dmar_readq(iommu->reg, cap_fault_reg_offset(cap)));
-    printk(" fault_recording_reg_h = %"PRIx64"\n",
-           dmar_readq(iommu->reg, cap_fault_reg_offset(cap) + 8));
+    if ( cap_fault_reg_offset(cap) < PAGE_SIZE )
+    {
+        printk(" fault_recording_reg_l = %"PRIx64"\n",
+               dmar_readq(iommu->reg, cap_fault_reg_offset(cap)));
+        printk(" fault_recording_reg_h = %"PRIx64"\n",
+               dmar_readq(iommu->reg, cap_fault_reg_offset(cap) + 8));
+    }
     printk(" ECAP = %"PRIx64"\n", dmar_readq(iommu->reg, DMAR_ECAP_REG));
     printk(" GCMD = %x\n", dmar_readl(iommu->reg, DMAR_GCMD_REG));
     printk(" GSTS = %x\n", dmar_readl(iommu->reg, DMAR_GSTS_REG));



Attachment: vtd-print-regs-check.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] VT-d: avoid faulting in print_iommu_regs(), Jan Beulich <=