[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.4] x86: don't leak ST(n)/XMMn values to domains first using them
commit 52a5c0bf5350f045810d159af0c06305dd9d517f Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Thu Dec 17 14:30:57 2015 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Dec 17 14:30:57 2015 +0100 x86: don't leak ST(n)/XMMn values to domains first using them FNINIT doesn't alter these registers, and hence using it is insufficient to initialize a guest's initial state. This is CVE-2015-8555 / XSA-165. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> master commit: 81818b3f277544535974204f8d840da86fa8a44f master date: 2015-12-17 14:22:13 +0100 --- xen/arch/x86/domain.c | 11 +++++++++++ xen/arch/x86/i387.c | 31 +++++++++---------------------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 062cff0..4efef9a 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -751,6 +751,17 @@ int arch_set_info_guest( if ( v->arch.xsave_area ) v->arch.xsave_area->xsave_hdr.xstate_bv = XSTATE_FP_SSE; } + else if ( v->arch.xsave_area ) + memset(&v->arch.xsave_area->xsave_hdr, 0, + sizeof(v->arch.xsave_area->xsave_hdr)); + else + { + typeof(v->arch.xsave_area->fpu_sse) *fpu_sse = v->arch.fpu_ctxt; + + memset(fpu_sse, 0, sizeof(*fpu_sse)); + fpu_sse->fcw = FCW_DEFAULT; + fpu_sse->mxcsr = MXCSR_DEFAULT; + } if ( !compat ) { diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c index a372e0b..58fb7b7 100644 --- a/xen/arch/x86/i387.c +++ b/xen/arch/x86/i387.c @@ -17,19 +17,6 @@ #include <asm/xstate.h> #include <asm/asm_defns.h> -static void fpu_init(void) -{ - unsigned long val; - - asm volatile ( "fninit" ); - if ( cpu_has_xmm ) - { - /* load default value into MXCSR control/status register */ - val = MXCSR_DEFAULT; - asm volatile ( "ldmxcsr %0" : : "m" (val) ); - } -} - /*******************************/ /* FPU Restore Functions */ /*******************************/ @@ -248,15 +235,8 @@ void vcpu_restore_fpu_lazy(struct vcpu *v) if ( cpu_has_xsave ) fpu_xrstor(v, XSTATE_LAZY); - else if ( v->fpu_initialised ) - { - if ( cpu_has_fxsr ) - fpu_fxrstor(v); - else - fpu_frstor(v); - } else - fpu_init(); + fpu_fxrstor(v); v->fpu_initialised = 1; v->fpu_dirtied = 1; @@ -317,7 +297,14 @@ int vcpu_init_fpu(struct vcpu *v) else { v->arch.fpu_ctxt = _xzalloc(sizeof(v->arch.xsave_area->fpu_sse), 16); - if ( !v->arch.fpu_ctxt ) + if ( v->arch.fpu_ctxt ) + { + typeof(v->arch.xsave_area->fpu_sse) *fpu_sse = v->arch.fpu_ctxt; + + fpu_sse->fcw = FCW_DEFAULT; + fpu_sse->mxcsr = MXCSR_DEFAULT; + } + else { rc = -ENOMEM; goto done; -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.4 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |