From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shuai Ruan Subject: [PATCH 2/3] x86/xsaves: fix overwriting between non-lazy/lazy xsave[sc] Date: Mon, 22 Feb 2016 13:35:20 +0800 Message-ID: <1456119321-10384-3-git-send-email-shuai.ruan@linux.intel.com> References: <1456119321-10384-1-git-send-email-shuai.ruan@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1456119321-10384-1-git-send-email-shuai.ruan@linux.intel.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: xen-devel@lists.xen.org Cc: wei.liu2@citrix.com, Ian.Campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, jbeulich@suse.com, keir@xen.org List-Id: xen-devel@lists.xenproject.org The offset at which components xsaved by xsave[sc] are not fixed. So when when a save with v->fpu_dirtied set is followed by one with v->fpu_dirtied clear, non-lazy xsave[sc] may overwriting data written by the lazy one. When xsave[sc] is enable, vcpu_xsave_mask will return XSTATE_ALL when v->fpu_dirtied clear and v->arch.nonlazy_xstate_used is set. Signed-off-by: Shuai Ruan --- xen/arch/x86/i387.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c index 67016c9..e3a7bc0 100644 --- a/xen/arch/x86/i387.c +++ b/xen/arch/x86/i387.c @@ -118,7 +118,7 @@ static inline uint64_t vcpu_xsave_mask(const struct vcpu *v) if ( v->fpu_dirtied ) return v->arch.nonlazy_xstate_used ? XSTATE_ALL : XSTATE_LAZY; - return v->arch.nonlazy_xstate_used ? XSTATE_NONLAZY : 0; + return ( cpu_has_xsaves || cpu_has_xsavec ) ? XSTATE_ALL : XSTATE_NONLAZY; } /* Save x87 extended state */ -- 1.9.1