From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] KVM: x86: Fix cmpxchg with two 32-bit registers Date: Mon, 27 Apr 2015 15:37:10 +0200 Message-ID: <553E3B86.2000709@redhat.com> References: <1430061048-14958-1-git-send-email-namit@cs.technion.ac.il> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Nadav Amit Return-path: Received: from mx1.redhat.com ([209.132.183.28]:40279 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753016AbbD0NhW (ORCPT ); Mon, 27 Apr 2015 09:37:22 -0400 In-Reply-To: <1430061048-14958-1-git-send-email-namit@cs.technion.ac.il> Sender: kvm-owner@vger.kernel.org List-ID: On 26/04/2015 17:10, Nadav Amit wrote: > The emulation of CMPXCHG with two register operands in 64-bit mistakenly masks > the high 32-bits as it performs assignment. Fix it. > > Fixes: 2fcf5c8ae244b4c298d2111a288d410a719ac626 > > Signed-off-by: Nadav Amit > --- > arch/x86/kvm/emulate.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c > index 630bcb0..84c132b 100644 > --- a/arch/x86/kvm/emulate.c > +++ b/arch/x86/kvm/emulate.c > @@ -2242,6 +2242,8 @@ static int em_cmpxchg(struct x86_emulate_ctxt *ctxt) > ctxt->src.val = ctxt->dst.orig_val; > /* Create write-cycle to dest by writing the same value */ > ctxt->dst.val = ctxt->dst.orig_val; > + if (ctxt->dst.type != OP_MEM) > + ctxt->dst.type = OP_NONE; > } > return X86EMUL_CONTINUE; > } > Applied, thanks. Paolo