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

[Xen-changelog] Fix a bug in shadow_remove_all_access_in_page.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 36e74b5dfa95e5a5e990df277dfba1b7b2774ff7
# Parent  1cb7adaa33555ac81d79c3f3cc868bc981557220
Fix a bug in shadow_remove_all_access_in_page.

Fixes a fairly obvious bug, in which an if statement was reversed.  The
bug has been present for a while, so apparently this code isn't well
tested.

Signed-off-by: Michael Vrable <mvrable@xxxxxxxxxxx>

diff -r 1cb7adaa3355 -r 36e74b5dfa95 xen/arch/x86/shadow32.c
--- a/xen/arch/x86/shadow32.c   Tue Sep 13 08:35:41 2005
+++ b/xen/arch/x86/shadow32.c   Tue Sep 13 09:09:59 2005
@@ -2214,7 +2214,7 @@
     struct domain *d, unsigned long l1mfn, unsigned long forbidden_gmfn)
 {
     l1_pgentry_t *pl1e = map_domain_page(l1mfn);
-    l1_pgentry_t match;
+    l1_pgentry_t match, ol2e;
     unsigned long flags  = _PAGE_PRESENT;
     int i;
     u32 count = 0;
@@ -2226,17 +2226,17 @@
     
     for (i = 0; i < L1_PAGETABLE_ENTRIES; i++)
     {
-        if ( unlikely(!l1e_has_changed(pl1e[i], match, flags) == 0) )
-        {
-            l1_pgentry_t ol2e = pl1e[i];
-            pl1e[i] = l1e_empty();
-            count++;
-
-            if ( is_l1_shadow )
-                shadow_put_page_from_l1e(ol2e, d);
-            else /* must be an hl2 page */
-                put_page(&frame_table[forbidden_gmfn]);
-        }
+        if ( l1e_has_changed(pl1e[i], match, flags) )
+            continue;
+
+        ol2e = pl1e[i];
+        pl1e[i] = l1e_empty();
+        count++;
+
+        if ( is_l1_shadow )
+            shadow_put_page_from_l1e(ol2e, d);
+        else /* must be an hl2 page */
+            put_page(&frame_table[forbidden_gmfn]);
     }
 
     unmap_domain_page(pl1e);
diff -r 1cb7adaa3355 -r 36e74b5dfa95 xen/arch/x86/shadow_public.c
--- a/xen/arch/x86/shadow_public.c      Tue Sep 13 08:35:41 2005
+++ b/xen/arch/x86/shadow_public.c      Tue Sep 13 09:09:59 2005
@@ -1622,7 +1622,7 @@
     struct domain *d, unsigned long l1mfn, unsigned long forbidden_gmfn)
 {
     l1_pgentry_t *pl1e = map_domain_page(l1mfn);
-    l1_pgentry_t match;
+    l1_pgentry_t match, ol2e;
     unsigned long flags  = _PAGE_PRESENT;
     int i;
     u32 count = 0;
@@ -1634,17 +1634,17 @@
 
     for (i = 0; i < L1_PAGETABLE_ENTRIES; i++)
     {
-        if ( unlikely(!l1e_has_changed(pl1e[i], match, flags) == 0) )
-        {
-            l1_pgentry_t ol2e = pl1e[i];
-            pl1e[i] = l1e_empty();
-            count++;
-
-            if ( is_l1_shadow )
-                shadow_put_page_from_l1e(ol2e, d);
-            else /* must be an hl2 page */
-                put_page(&frame_table[forbidden_gmfn]);
-        }
+        if ( l1e_has_changed(pl1e[i], match, flags) )
+            continue;
+
+        ol2e = pl1e[i];
+        pl1e[i] = l1e_empty();
+        count++;
+
+        if ( is_l1_shadow )
+            shadow_put_page_from_l1e(ol2e, d);
+        else /* must be an hl2 page */
+            put_page(&frame_table[forbidden_gmfn]);
     }
 
     unmap_domain_page(pl1e);

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