Commit 9b22bf57 authored by Dor Laor's avatar Dor Laor Committed by Avi Kivity

KVM: Fix guest register corruption on paravirt hypercall

The hypercall code mixes up the ->cache_regs() and ->decache_regs()
callbacks, resulting in guest register corruption.
Signed-off-by: default avatarDor Laor <dor.laor@qumranet.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent dc87c398
...@@ -1177,7 +1177,7 @@ int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run) ...@@ -1177,7 +1177,7 @@ int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run)
{ {
unsigned long nr, a0, a1, a2, a3, a4, a5, ret; unsigned long nr, a0, a1, a2, a3, a4, a5, ret;
kvm_arch_ops->decache_regs(vcpu); kvm_arch_ops->cache_regs(vcpu);
ret = -KVM_EINVAL; ret = -KVM_EINVAL;
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
if (is_long_mode(vcpu)) { if (is_long_mode(vcpu)) {
...@@ -1204,7 +1204,7 @@ int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run) ...@@ -1204,7 +1204,7 @@ int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run)
; ;
} }
vcpu->regs[VCPU_REGS_RAX] = ret; vcpu->regs[VCPU_REGS_RAX] = ret;
kvm_arch_ops->cache_regs(vcpu); kvm_arch_ops->decache_regs(vcpu);
return 1; return 1;
} }
EXPORT_SYMBOL_GPL(kvm_hypercall); EXPORT_SYMBOL_GPL(kvm_hypercall);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment