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 4] MCA physical address check when calculate domain

To: Keir Fraser <keir.xen@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 4] MCA physical address check when calculate domain
From: "Liu, Jinsong" <jinsong.liu@xxxxxxxxx>
Date: Sun, 8 May 2011 04:29:19 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>, "Li, Xin" <xin.li@xxxxxxxxx>
Delivery-date: Sat, 07 May 2011 13:30:08 -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
Thread-index: AcwM9XEj+DnJquAfR8KPKcFagYLuSA==
Thread-topic: [PATCH 4] MCA physical address check when calculate domain
MCA physical address check when calculate domain

Bank addr maybe invalid, or 
Bank addr maybe physical/memory/linear address or segment offset.
This patch add mca MCi_STATUS_MISCV/MCi_STATUS_ADDRV check, and add physical 
address verify,
so that it work safe when calculate domain.

Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>

diff -r e4e1efda200f xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c     Thu May 05 13:54:29 2011 +0800
+++ b/xen/arch/x86/cpu/mcheck/mce.c     Fri May 06 13:56:21 2011 +0800
@@ -151,7 +151,6 @@ static struct mcinfo_bank *mca_init_bank
                                          struct mc_info *mi, int bank)
 {
     struct mcinfo_bank *mib;
-    uint64_t addr=0, misc = 0;
 
     if (!mi)
         return NULL;
@@ -170,22 +169,23 @@ static struct mcinfo_bank *mca_init_bank
     mib->common.size = sizeof (struct mcinfo_bank);
     mib->mc_bank = bank;
 
-    addr = misc = 0;
     if (mib->mc_status & MCi_STATUS_MISCV)
         mib->mc_misc = mca_rdmsr(MSR_IA32_MCx_MISC(bank));
 
     if (mib->mc_status & MCi_STATUS_ADDRV)
-    {
         mib->mc_addr = mca_rdmsr(MSR_IA32_MCx_ADDR(bank));
 
-        if (mfn_valid(paddr_to_pfn(mib->mc_addr))) {
-            struct domain *d;
+    if ((mib->mc_status & MCi_STATUS_MISCV) &&
+        (mib->mc_status & MCi_STATUS_ADDRV) &&
+        ((mib->mc_misc & MCi_MISC_ADDRMOD_MASK) == MCi_MISC_PHYSMOD) && 
+          mfn_valid(paddr_to_pfn(mib->mc_addr)))
+    {
+        struct domain *d;
 
-            d = maddr_get_owner(mib->mc_addr);
-            if (d != NULL && (who == MCA_POLLER ||
-                              who == MCA_CMCI_HANDLER))
-                mib->mc_domid = d->domain_id;
-        }
+        d = maddr_get_owner(mib->mc_addr);
+        if (d != NULL && (who == MCA_POLLER ||
+                          who == MCA_CMCI_HANDLER))
+            mib->mc_domid = d->domain_id;
     }
 
     if (who == MCA_CMCI_HANDLER) {

Attachment: mca-cleanup-4.patch
Description: mca-cleanup-4.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel