From: Andrew Cooper Subject: [PATCH] x86/shadow: shadow_enable() cannot be called on oneself Date: Fri, 31 Oct 2014 18:55:26 +0000 Message-ID: <1414781726-32342-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper , Keir Fraser , Jan Beulich , Tim Deegan List-Id: xen-devel@lists.xenproject.org domain_pause() ASSERT()s that d != current->domain, making this particular sanity check unconditionally false. The two callpaths leading here are from hvm_domain_initialise() (which absolutely can't be on oneself) and paging_domctl() (which checks and rejects domctls one oneself). Signed-off-by: Andrew Cooper CC: Keir Fraser CC: Jan Beulich CC: Tim Deegan --- xen/arch/x86/mm/shadow/common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index a5eed28..57a1500 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -2929,8 +2929,7 @@ int shadow_enable(struct domain *d, u32 mode) domain_pause(d); /* Sanity check the arguments */ - if ( (d == current->domain) || - shadow_mode_enabled(d) || + if ( shadow_mode_enabled(d) || ((mode & PG_translate) && !(mode & PG_refcounts)) || ((mode & PG_external) && !(mode & PG_translate)) ) { -- 1.7.10.4