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

[Xen-changelog] Fix bug with get_page_type where validating an L2/L3/L4 page which contained a self



ChangeSet 1.1310, 2005/04/18 16:19:54+01:00, maf46@xxxxxxxxxxxxxxxxx

        Fix bug with get_page_type where validating an L2/L3/L4 page which 
contained a self
        reference would cause xen to busy-wait forever.
        
        Signed-off-by: michael.fetterman@xxxxxxxxxxxx



 mm.c |   53 ++++++++++++++++++++++++++++-------------------------
 1 files changed, 28 insertions(+), 25 deletions(-)


diff -Nru a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c 2005-04-18 21:03:25 -04:00
+++ b/xen/arch/x86/mm.c 2005-04-18 21:03:25 -04:00
@@ -1229,35 +1229,38 @@
                     nx |= PGT_validated;
             }
         }
-        else if ( unlikely(!(x & PGT_validated)) )
+        else
         {
-            /* Someone else is updating validation of this page. Wait... */
-            while ( (y = page->u.inuse.type_info) == x )
-                cpu_relax();
-            goto again;
-        }
-        else if ( unlikely((x & (PGT_type_mask|PGT_va_mask)) != type) )
-        {
-            if ( unlikely((x & PGT_type_mask) != (type & PGT_type_mask) ) )
-            {
-                if ( ((x & PGT_type_mask) != PGT_l2_page_table) ||
-                     ((type & PGT_type_mask) != PGT_l1_page_table) )
-                    MEM_LOG("Bad type (saw %08x != exp %08x) for pfn %p",
-                            x, type, page_to_pfn(page));
-                return 0;
-            }
-            else if ( (x & PGT_va_mask) == PGT_va_mutable )
+            if ( unlikely((x & (PGT_type_mask|PGT_va_mask)) != type) )
             {
-                /* The va backpointer is mutable, hence we update it. */
-                nx &= ~PGT_va_mask;
-                nx |= type; /* we know the actual type is correct */
+                if ( unlikely((x & PGT_type_mask) != (type & PGT_type_mask) ) )
+                {
+                    if ( ((x & PGT_type_mask) != PGT_l2_page_table) ||
+                         ((type & PGT_type_mask) != PGT_l1_page_table) )
+                        MEM_LOG("Bad type (saw %08x != exp %08x) for pfn %p",
+                                x, type, page_to_pfn(page));
+                    return 0;
+                }
+                else if ( (x & PGT_va_mask) == PGT_va_mutable )
+                {
+                    /* The va backpointer is mutable, hence we update it. */
+                    nx &= ~PGT_va_mask;
+                    nx |= type; /* we know the actual type is correct */
+                }
+                else if ( ((type & PGT_va_mask) != PGT_va_mutable) &&
+                          ((type & PGT_va_mask) != (x & PGT_va_mask)) )
+                {
+                    /* This table is potentially mapped at multiple locations. 
*/
+                    nx &= ~PGT_va_mask;
+                    nx |= PGT_va_unknown;
+                }
             }
-            else if ( ((type & PGT_va_mask) != PGT_va_mutable) &&
-                      ((type & PGT_va_mask) != (x & PGT_va_mask)) )
+            if ( unlikely(!(x & PGT_validated)) )
             {
-                /* This table is potentially mapped at multiple locations. */
-                nx &= ~PGT_va_mask;
-                nx |= PGT_va_unknown;
+                /* Someone else is updating validation of this page. Wait... */
+                while ( (y = page->u.inuse.type_info) == x )
+                    cpu_relax();
+                goto again;
             }
         }
     }

_______________________________________________
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®.