WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] xenpaging: clear page content after evict

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] xenpaging: clear page content after evict
From: Olaf Hering <olaf@xxxxxxxxx>
Date: Sat, 08 Oct 2011 09:15:33 +0200
Delivery-date: Sat, 08 Oct 2011 00:17:16 -0700
Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1318058163; l=1356; s=domk; d=aepfle.de; h=To:From:Date:Subject:Content-Transfer-Encoding:MIME-Version: Content-Type:X-RZG-CLASS-ID:X-RZG-AUTH; bh=vhvma0bmKAn9IgCHU3JK9dTyd08=; b=koFypRDY5BF/NJM2GTixkEXl9Mlp1Q8fp6pNJpwM5MCJLXfxDzyQ/2o9WggRedQRJ1z NdDSTO1Jzg+5lo/pe7gQ4q3twv9p8op9a95yQ1WEh54QEXoudku+avZeZYBhyCcjk5ZKu bAnsPv8QGytTvWX7ktWXlSubFAIXWy/vSsw=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.7.5
# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# 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.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>

diff -r eec5d0b44f76 -r f67616df0e08 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c
+++ b/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 */
diff -r eec5d0b44f76 -r f67616df0e08 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c
+++ b/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);
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>