From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Deegan Subject: [PATCH] x86/shadow: unconditionally set the p2m/log-dirty allocation functions Date: Mon, 14 Feb 2011 13:50:09 +0000 Message-ID: <2af74339b90422fc26ba.1297691409@whitby.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6271753804430328325==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Gianni.Tedesco@citrix.com List-Id: xen-devel@lists.xenproject.org --===============6271753804430328325== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Otherwise enabling log-dirty mode on a PV guest that already has a shadow allocation can leave the alloc/free functions pointers NULL, and later try to dereference them. Signed-off-by: Tim Deegan --===============6271753804430328325== Content-Type: text/x-patch; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen-unstable.hg.patch" # HG changeset patch # User Tim Deegan # Date 1297690988 0 # Node ID 2af74339b90422fc26ba7aebd7868b1eb802de2f # Parent 20140bcb4c047c5410594b3acc9e8b1f243b8ff9 x86/shadow: unconditionally set the p2m/log-dirty allocation functions. Otherwise enabling log-dirty mode on a PV guest that already has a shadow allocation can leave the alloc/free functions pointers NULL, and later try to dereference them. Signed-off-by: Tim Deegan diff -r 20140bcb4c04 -r 2af74339b904 xen/arch/x86/mm/shadow/common.c --- a/xen/arch/x86/mm/shadow/common.c Mon Feb 14 13:40:32 2011 +0000 +++ b/xen/arch/x86/mm/shadow/common.c Mon Feb 14 13:43:08 2011 +0000 @@ -3337,12 +3337,12 @@ static int shadow_one_bit_enable(struct sh_set_allocation(d, 0, NULL); return -ENOMEM; } - - /* Allow p2m and log-dirty code to borrow shadow memory */ - d->arch.paging.alloc_page = shadow_alloc_p2m_page; - d->arch.paging.free_page = shadow_free_p2m_page; } + /* Allow p2m and log-dirty code to borrow shadow memory */ + d->arch.paging.alloc_page = shadow_alloc_p2m_page; + d->arch.paging.free_page = shadow_free_p2m_page; + if ( d->arch.paging.mode == 0 ) { /* Init the shadow hash table */ --===============6271753804430328325== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============6271753804430328325==--