From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [PATCH 5/5] x86/PV: don't commit debug register values early in arch_set_info_guest() Date: Tue, 10 Dec 2013 17:33:18 +0000 Message-ID: <52A7505E.5060301@eu.citrix.com> References: <52A744B7020000780010BEF1@nat28.tlf.novell.com> <52A745FA020000780010BF2E@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" 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 1VqRBi-0005Zm-62 for xen-devel@lists.xenproject.org; Tue, 10 Dec 2013 17:33:38 +0000 In-Reply-To: <52A745FA020000780010BF2E@nat28.tlf.novell.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: Jan Beulich , xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org On 12/10/2013 03:48 PM, Jan Beulich wrote: > They're being taken care of later (via set_debugreg()), and temporarily > copying them into struct vcpu means that bad values may end up getting > loaded during context switch if the vCPU is already running and the > function errors out between the premature and real commit step, leading > to the same issue that XSA-12 dealt with. > > Signed-off-by: Jan Beulich > Acked-by: Ian Campbell Release-acked-by: George Dunlap > > --- a/xen/arch/x86/domain.c > +++ b/xen/arch/x86/domain.c > @@ -740,11 +740,12 @@ int arch_set_info_guest( > XLAT_trap_info(v->arch.pv_vcpu.trap_ctxt + i, > c.cmp->trap_ctxt + i); > } > - for ( i = 0; i < ARRAY_SIZE(v->arch.debugreg); ++i ) > - v->arch.debugreg[i] = c(debugreg[i]); > > if ( has_hvm_container_vcpu(v) ) > { > + for ( i = 0; i < ARRAY_SIZE(v->arch.debugreg); ++i ) > + v->arch.debugreg[i] = c(debugreg[i]); > + > /* > * NB: TF_kernel_mode is set unconditionally for HVM guests, > * so we always use the gs_base_kernel here. If we change this > > >