Skip to contentSkip to conversation

xenpaging: clear page content after evict

PATCH Applied Olaf Hering 3 participants 3 messages Oct 8, 2011 – Oct 11, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xenpaging: clear page content after evict

# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1318005908 -7200
# Node ID f67616df0e0891ddddba3cbe4e7db816816abf0d # Parent eec5d0b44f76ebe748a6279f5c847d719bdc72e6
xenpaging: clear page content after evict

If the guest happens to read from the gfn while xenpaging is in the process of evicting the page, the guest may read zeros instead of actual data. Also if eviction fails the page content will be corrupted and xenpaging wont attempt to restore the page.

Remove page scrubbing from pager and do it after successful eviction.

tools/xenpaging/xenpaging.c +0 -3
diff -r eec5d0b44f76 -r f67616df0e08 tools/xenpaging/xenpaging.c
@@ -455,9 +455,6 @@ static int xenpaging_evict_page(xenpagin
         goto out;
     }
 
-    /* Clear page */
-    memset(page, 0, PAGE_SIZE);
-
     munmap(page, PAGE_SIZE);
 
     /* Tell Xen to evict page */
xen/arch/x86/mm/p2m.c +3 -0
diff -r eec5d0b44f76 -r f67616df0e08 xen/arch/x86/mm/p2m.c
@@ -748,6 +748,9 @@ int p2m_mem_paging_evict(struct domain *
     set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, p2m_ram_paged, a);
     audit_p2m(p2m, 1);
 
+    /* Clear content before returning the page to Xen */
+    scrub_one_page(page);
+
     /* Put the page back so it gets freed */
     put_page(page);
Acked-by on v1 1/1
#1 lore raw

Olaf Hering writes ("[Xen-devel] [PATCH] xenpaging: clear page content after evi> xenpaging: clear page content after evict

Quoted 5 lines

If the guest happens to read from the gfn while xenpaging is in the process of evicting the page, the guest may read zeros instead of actual data. Also if eviction fails the page content will be corrupted and xenpaging wont attempt to restore the page.

As far as the tools are concerned,

Ian.

Applied
#2 lore raw
In reply to Olaf Hering
Quoted 10 lines · Olaf Hering

xenpaging: clear page content after evict

If the guest happens to read from the gfn while xenpaging is in the process of evicting the page, the guest may read zeros instead of actual data. Also if eviction fails the page content will be corrupted and xenpaging wont attempt to restore the page.

Remove page scrubbing from pager and do it after successful eviction.

Applied, thanks.

Tim.