From: "Jan Beulich" Subject: Re: [PATCH RFC v12 09/21] pvh: Do not allow PVH guests to change paging modes Date: Wed, 18 Sep 2013 15:32:06 +0100 Message-ID: <5239D58602000078000F46BA@nat28.tlf.novell.com> References: <1379089521-25720-1-git-send-email-george.dunlap@eu.citrix.com> <1379089521-25720-10-git-send-email-george.dunlap@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VMInb-0001Bq-MB for xen-devel@lists.xenproject.org; Wed, 18 Sep 2013 14:32:11 +0000 In-Reply-To: <1379089521-25720-10-git-send-email-george.dunlap@eu.citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap Cc: xen-devel , Keir Fraser , Tim Deegan List-Id: xen-devel@lists.xenproject.org >>> On 13.09.13 at 18:25, George Dunlap wrote: > Signed-off-by: George Dunlap > Signed-off-by: Mukesh Rathor Reviewed-by: Jan Beulich once again with a minor comment: > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@ -1743,7 +1743,17 @@ int hvm_set_cr0(unsigned long value) > (value & (X86_CR0_PE | X86_CR0_PG)) == X86_CR0_PG ) > goto gpf; > > - if ( (value & X86_CR0_PG) && !(old_value & X86_CR0_PG) ) > + > + > + /* A pvh is not expected to change to real mode. */ > + if ( is_pvh_vcpu(v) > + && (value & (X86_CR0_PE | X86_CR0_PG)) != (X86_CR0_PG | X86_CR0_PE) ) > + { > + printk(XENLOG_G_WARNING > + "PVH attempting to turn off PE/PG. CR0:%lx\n", value); > + goto gpf; > + } > + else if ( (value & X86_CR0_PG) && !(old_value & X86_CR0_PG) ) It is pointless to follow a "goto" with an "else if". Jan