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

[Xen-changelog] [xen-unstable] On debug builds, scrub pages with non-zero poison.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1186140153 -3600
# Node ID cb3e6fcb7f34dd4cb46e46a3e5068c9333a06cda
# Parent  52e5c110aadb31d6086f0785dc1f52160bc8e5ba
On debug builds, scrub pages with non-zero poison.
Will flush out guests which are relying on zeroed memory.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/common/page_alloc.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff -r 52e5c110aadb -r cb3e6fcb7f34 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Fri Aug 03 12:10:35 2007 +0100
+++ b/xen/common/page_alloc.c   Fri Aug 03 12:22:33 2007 +0100
@@ -91,6 +91,14 @@ custom_param("dma_emergency_pool", parse
 #define round_pgdown(_p)  ((_p)&PAGE_MASK)
 #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
 
+#ifndef NDEBUG
+/* Avoid callers relying on allocations returning zeroed pages. */
+#define scrub_page(p) memset((p), 0xc2, PAGE_SIZE)
+#else
+/* For a production build, clear_page() is the fastest way to scrub. */
+#define scrub_page(p) clear_page(p)
+#endif
+
 static DEFINE_SPINLOCK(page_scrub_lock);
 LIST_HEAD(page_scrub_list);
 static unsigned long scrub_pages;
@@ -618,13 +626,13 @@ void __init scrub_heap_pages(void)
             {
                 p = page_to_virt(mfn_to_page(mfn));
                 memguard_unguard_range(p, PAGE_SIZE);
-                clear_page(p);
+                scrub_page(p);
                 memguard_guard_range(p, PAGE_SIZE);
             }
             else
             {
                 p = map_domain_page(mfn);
-                clear_page(p);
+                scrub_page(p);
                 unmap_domain_page(p);
             }
         }
@@ -1018,7 +1026,7 @@ static void page_scrub_softirq(void)
             pg = list_entry(ent, struct page_info, list);
             ent = ent->prev;
             p = map_domain_page(page_to_mfn(pg));
-            clear_page(p);
+            scrub_page(p);
             unmap_domain_page(p);
             free_heap_pages(pfn_dom_zone_type(page_to_mfn(pg)), pg, 0);
         }

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