ia64/xen-unstable

changeset 10215:c43080e63545

Fix infinite recursion loop in get_page_type() error path.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue May 30 18:11:34 2006 +0100 (2006-05-30)
parents e58e04589d11
children 0b98fcb98889
files xen/arch/x86/mm.c
line diff
     1.1 --- a/xen/arch/x86/mm.c	Tue May 30 13:29:29 2006 +0100
     1.2 +++ b/xen/arch/x86/mm.c	Tue May 30 18:11:34 2006 +0100
     1.3 @@ -1598,12 +1598,18 @@ int get_page_type(struct page_info *page
     1.4              {
     1.5                  if ( unlikely((x & PGT_type_mask) != (type & PGT_type_mask) ) )
     1.6                  {
     1.7 -                    if ( current->domain == page_get_owner(page) )
     1.8 +                    if ( (current->domain == page_get_owner(page)) &&
     1.9 +                         ((x & PGT_type_mask) == PGT_writable_page) )
    1.10                      {
    1.11                          /*
    1.12                           * This ensures functions like set_gdt() see up-to-date
    1.13                           * type info without needing to clean up writable p.t.
    1.14 -                         * state on the fast path.
    1.15 +                         * state on the fast path. We take this path only
    1.16 +                         * when the current type is writable because:
    1.17 +                         *  1. It's the only type that this path can decrement.
    1.18 +                         *  2. If we take this path more liberally then we can
    1.19 +                         *     enter a recursive loop via get_page_from_l1e()
    1.20 +                         *     during pagetable revalidation.
    1.21                           */
    1.22                          LOCK_BIGLOCK(current->domain);
    1.23                          cleanup_writable_pagetable(current->domain);