summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNadav Amit2014-09-18 21:39:45 +0200
committerPaolo Bonzini2014-11-03 12:07:21 +0100
commitbf0b682c9b6a6d6d54adf439bfe953feef7be2e8 (patch)
tree9e344bd659494bcfca3bfc5439fe21fec1dfa68a
parentKVM: x86: Distinguish between stack operation and near branches (diff)
downloadkernel-qcow2-linux-bf0b682c9b6a6d6d54adf439bfe953feef7be2e8.tar.gz
kernel-qcow2-linux-bf0b682c9b6a6d6d54adf439bfe953feef7be2e8.tar.xz
kernel-qcow2-linux-bf0b682c9b6a6d6d54adf439bfe953feef7be2e8.zip
KVM: x86: Sysexit emulation does not mask RIP/RSP
If the operand size is not 64-bit, then the sysexit instruction should assign ECX to RSP and EDX to RIP. The current code assigns the full 64-bits. Fix it by masking. Signed-off-by: Nadav Amit <namit@cs.technion.ac.il> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/x86/kvm/emulate.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index a90fa188aeea..058aff86cfba 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2417,6 +2417,8 @@ static int em_sysexit(struct x86_emulate_ctxt *ctxt)
if ((msr_data & 0xfffc) == 0x0)
return emulate_gp(ctxt, 0);
ss_sel = (u16)(msr_data + 24);
+ rcx = (u32)rcx;
+ rdx = (u32)rdx;
break;
case X86EMUL_MODE_PROT64:
cs_sel = (u16)(msr_data + 32);