* [PATCH] KVM: x86: Fix cmpxchg with two 32-bit registers
@ 2015-04-26 15:10 Nadav Amit
2015-04-27 13:37 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Nadav Amit @ 2015-04-26 15:10 UTC (permalink / raw)
To: pbonzini; +Cc: kvm, Nadav Amit
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 <namit@cs.technion.ac.il>
---
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;
}
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: x86: Fix cmpxchg with two 32-bit registers
2015-04-26 15:10 [PATCH] KVM: x86: Fix cmpxchg with two 32-bit registers Nadav Amit
@ 2015-04-27 13:37 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2015-04-27 13:37 UTC (permalink / raw)
To: Nadav Amit; +Cc: kvm
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 <namit@cs.technion.ac.il>
> ---
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-27 13:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-26 15:10 [PATCH] KVM: x86: Fix cmpxchg with two 32-bit registers Nadav Amit
2015-04-27 13:37 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).