mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-20 01:24:39 +08:00
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: Dor Laor <dor.laor@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
This commit is contained in:
parent
dc87c3985e
commit
9b22bf5783
@ -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;
|
||||
|
||||
kvm_arch_ops->decache_regs(vcpu);
|
||||
kvm_arch_ops->cache_regs(vcpu);
|
||||
ret = -KVM_EINVAL;
|
||||
#ifdef CONFIG_X86_64
|
||||
if (is_long_mode(vcpu)) {
|
||||
@ -1204,7 +1204,7 @@ int kvm_hypercall(struct kvm_vcpu *vcpu, struct kvm_run *run)
|
||||
;
|
||||
}
|
||||
vcpu->regs[VCPU_REGS_RAX] = ret;
|
||||
kvm_arch_ops->cache_regs(vcpu);
|
||||
kvm_arch_ops->decache_regs(vcpu);
|
||||
return 1;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kvm_hypercall);
|
||||
|
Loading…
Reference in New Issue
Block a user