ia64/xen-unstable

changeset 17158:9becbdd13b31

x86 shadow: shadow_check_gwalk() must sh_unmap_domain_page() each page
it temporarily maps.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 28 16:02:00 2008 +0000 (2008-02-28)
parents 91316e501e92
children 8271e1268828
files xen/arch/x86/mm/shadow/multi.c
line diff
     1.1 --- a/xen/arch/x86/mm/shadow/multi.c	Thu Feb 28 15:03:33 2008 +0000
     1.2 +++ b/xen/arch/x86/mm/shadow/multi.c	Thu Feb 28 16:02:00 2008 +0000
     1.3 @@ -256,6 +256,7 @@ shadow_check_gwalk(struct vcpu *v, unsig
     1.4      guest_l3e_t *l3p;
     1.5      guest_l4e_t *l4p;
     1.6  #endif
     1.7 +    int mismatch = 0;
     1.8  
     1.9      ASSERT(shadow_locked_by_me(d));
    1.10  
    1.11 @@ -277,33 +278,30 @@ shadow_check_gwalk(struct vcpu *v, unsig
    1.12  #if GUEST_PAGING_LEVELS >= 3 /* PAE or 64... */
    1.13  #if GUEST_PAGING_LEVELS >= 4 /* 64-bit only... */
    1.14      l4p = (guest_l4e_t *)v->arch.paging.shadow.guest_vtable;
    1.15 -    if ( gw->l4e.l4 != l4p[guest_l4_table_offset(va)].l4 )
    1.16 -        return 0;
    1.17 +    mismatch |= (gw->l4e.l4 != l4p[guest_l4_table_offset(va)].l4);
    1.18      l3p = sh_map_domain_page(gw->l3mfn);
    1.19 -    if ( gw->l3e.l3 != l3p[guest_l3_table_offset(va)].l3 )
    1.20 -        return 0; 
    1.21 +    mismatch |= (gw->l3e.l3 != l3p[guest_l3_table_offset(va)].l3);
    1.22 +    sh_unmap_domain_page(l3p);
    1.23  #else
    1.24 -    if ( gw->l3e.l3 !=
    1.25 -         v->arch.paging.shadow.gl3e[guest_l3_table_offset(va)].l3 )
    1.26 -        return 0;
    1.27 +    mismatch |= (gw->l3e.l3 !=
    1.28 +                 v->arch.paging.shadow.gl3e[guest_l3_table_offset(va)].l3);
    1.29  #endif
    1.30      l2p = sh_map_domain_page(gw->l2mfn);
    1.31 -    if ( gw->l2e.l2 != l2p[guest_l2_table_offset(va)].l2 )
    1.32 -        return 0;
    1.33 +    mismatch |= (gw->l2e.l2 != l2p[guest_l2_table_offset(va)].l2);
    1.34 +    sh_unmap_domain_page(l2p);
    1.35  #else
    1.36      l2p = (guest_l2e_t *)v->arch.paging.shadow.guest_vtable;
    1.37 -    if ( gw->l2e.l2 != l2p[guest_l2_table_offset(va)].l2 )
    1.38 -        return 0;
    1.39 +    mismatch |= (gw->l2e.l2 != l2p[guest_l2_table_offset(va)].l2);
    1.40  #endif
    1.41      if ( !(guest_supports_superpages(v) &&
    1.42             (guest_l2e_get_flags(gw->l2e) & _PAGE_PSE)) )
    1.43      {
    1.44          l1p = sh_map_domain_page(gw->l1mfn);
    1.45 -        if ( gw->l1e.l1 != l1p[guest_l1_table_offset(va)].l1 )
    1.46 -            return 0;
    1.47 +        mismatch |= (gw->l1e.l1 != l1p[guest_l1_table_offset(va)].l1);
    1.48 +        sh_unmap_domain_page(l1p);
    1.49      }
    1.50  
    1.51 -    return 1;
    1.52 +    return !mismatch;
    1.53  }
    1.54  
    1.55  /* Remove write access permissions from a gwalk_t in a batch, and