[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: Fix get_page_from_l1e() and avoid host crash on 'xm save'.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1192800610 -3600
# Node ID 6236adfbebe667d7509b9c81081e48c1a7fb3672
# Parent  bf3514726c1b84c0a284f30a276b8420d700421f
x86: Fix get_page_from_l1e() and avoid host crash on 'xm save'.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/mm.c     |    9 ++++-----
 xen/common/rangeset.c |    2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff -r bf3514726c1b -r 6236adfbebe6 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Fri Oct 19 11:32:18 2007 +0100
+++ b/xen/arch/x86/mm.c Fri Oct 19 14:30:10 2007 +0100
@@ -152,7 +152,8 @@ unsigned long total_pages;
 #define PAGE_CACHE_ATTRS (_PAGE_PAT|_PAGE_PCD|_PAGE_PWT)
 
 #define l1_disallow_mask(d)                                     \
-    ((rangeset_is_empty((d)->iomem_caps) &&                     \
+    ((d != dom_io) &&                                           \
+     (rangeset_is_empty((d)->iomem_caps) &&                     \
       rangeset_is_empty((d)->arch.ioport_caps)) ?               \
      L1_DISALLOW_MASK : (L1_DISALLOW_MASK & ~PAGE_CACHE_ATTRS))
 
@@ -619,17 +620,15 @@ get_page_from_l1e(
 {
     unsigned long mfn = l1e_get_pfn(l1e);
     struct page_info *page = mfn_to_page(mfn);
-    unsigned int disallow_mask;
     int okay;
 
     if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) )
         return 1;
 
-    disallow_mask = l1_disallow_mask((d == dom_io) ? current->domain : d);
-    if ( unlikely(l1e_get_flags(l1e) & disallow_mask) )
+    if ( unlikely(l1e_get_flags(l1e) & l1_disallow_mask(d)) )
     {
         MEM_LOG("Bad L1 flags %x",
-                l1e_get_flags(l1e) & disallow_mask);
+                l1e_get_flags(l1e) & l1_disallow_mask(d));
         return 0;
     }
 
diff -r bf3514726c1b -r 6236adfbebe6 xen/common/rangeset.c
--- a/xen/common/rangeset.c     Fri Oct 19 11:32:18 2007 +0100
+++ b/xen/common/rangeset.c     Fri Oct 19 14:30:10 2007 +0100
@@ -263,7 +263,7 @@ int rangeset_is_empty(
 int rangeset_is_empty(
     struct rangeset *r)
 {
-    return list_empty(&r->range_list);
+    return ((r == NULL) || list_empty(&r->range_list));
 }
 
 struct rangeset *rangeset_new(

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.