From: Tim Deegan Subject: Re: [PATCH] x86/shadow: shadow_enable() cannot be called on oneself Date: Fri, 31 Oct 2014 20:49:28 +0100 Message-ID: <20141031194928.GA48048@deinos.phlegethon.org> References: <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: Content-Disposition: inline In-Reply-To: <1414781726-32342-1-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Keir Fraser , Jan Beulich , Xen-devel List-Id: xen-devel@lists.xenproject.org At 18:55 +0000 on 31 Oct (1414778126), Andrew Cooper wrote: > 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 Nak. This check is partly documentation and entirely harmless; I'd like to keep it. Tim. > --- > 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 >