From: Jan Beulich Date: Wed, 11 Dec 2013 09:33:19 +0000 (+0100) Subject: x86/PV: don't commit debug register values early in arch_set_info_guest() X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5766^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=398c39b6c18d0b55acfc88f5ee75b3a793e6eeec;p=xen.git x86/PV: don't commit debug register values early in arch_set_info_guest() 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 Reviewed-by: Andrew Cooper Release-acked-by: George Dunlap Acked-by: Keir Fraser --- diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index c0ac5d6d73..da8e52291c 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -743,11 +743,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]); + hvm_set_info_guest(v); if ( is_hvm_vcpu(v) || v->is_initialised )