ia64/xen-unstable

changeset 16162:6236adfbebe6

x86: Fix get_page_from_l1e() and avoid host crash on 'xm save'.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Fri Oct 19 14:30:10 2007 +0100 (2007-10-19)
parents bf3514726c1b
children 08295dc13166
files xen/arch/x86/mm.c xen/common/rangeset.c
line diff
     1.1 --- a/xen/arch/x86/mm.c	Fri Oct 19 11:32:18 2007 +0100
     1.2 +++ b/xen/arch/x86/mm.c	Fri Oct 19 14:30:10 2007 +0100
     1.3 @@ -152,7 +152,8 @@ unsigned long total_pages;
     1.4  #define PAGE_CACHE_ATTRS (_PAGE_PAT|_PAGE_PCD|_PAGE_PWT)
     1.5  
     1.6  #define l1_disallow_mask(d)                                     \
     1.7 -    ((rangeset_is_empty((d)->iomem_caps) &&                     \
     1.8 +    ((d != dom_io) &&                                           \
     1.9 +     (rangeset_is_empty((d)->iomem_caps) &&                     \
    1.10        rangeset_is_empty((d)->arch.ioport_caps)) ?               \
    1.11       L1_DISALLOW_MASK : (L1_DISALLOW_MASK & ~PAGE_CACHE_ATTRS))
    1.12  
    1.13 @@ -619,17 +620,15 @@ get_page_from_l1e(
    1.14  {
    1.15      unsigned long mfn = l1e_get_pfn(l1e);
    1.16      struct page_info *page = mfn_to_page(mfn);
    1.17 -    unsigned int disallow_mask;
    1.18      int okay;
    1.19  
    1.20      if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) )
    1.21          return 1;
    1.22  
    1.23 -    disallow_mask = l1_disallow_mask((d == dom_io) ? current->domain : d);
    1.24 -    if ( unlikely(l1e_get_flags(l1e) & disallow_mask) )
    1.25 +    if ( unlikely(l1e_get_flags(l1e) & l1_disallow_mask(d)) )
    1.26      {
    1.27          MEM_LOG("Bad L1 flags %x",
    1.28 -                l1e_get_flags(l1e) & disallow_mask);
    1.29 +                l1e_get_flags(l1e) & l1_disallow_mask(d));
    1.30          return 0;
    1.31      }
    1.32  
     2.1 --- a/xen/common/rangeset.c	Fri Oct 19 11:32:18 2007 +0100
     2.2 +++ b/xen/common/rangeset.c	Fri Oct 19 14:30:10 2007 +0100
     2.3 @@ -263,7 +263,7 @@ int rangeset_contains_singleton(
     2.4  int rangeset_is_empty(
     2.5      struct rangeset *r)
     2.6  {
     2.7 -    return list_empty(&r->range_list);
     2.8 +    return ((r == NULL) || list_empty(&r->range_list));
     2.9  }
    2.10  
    2.11  struct rangeset *rangeset_new(