Skip to content

Commit

Permalink
KVM: SVM: handle errors in vmrun emulation path appropriatly
Browse files Browse the repository at this point in the history
If nested svm fails to load the msrpm the vmrun succeeds with the old
msrpm which is not correct. This patch changes the logic to roll back
to host mode in case the msrpm cannot be loaded.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
  • Loading branch information
Joerg Roedel authored and Avi Kivity committed Sep 10, 2009
1 parent ea8e064 commit 1f8da47
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion arch/x86/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1874,6 +1874,7 @@ static int vmsave_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
static int vmrun_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
{
nsvm_printk("VMrun\n");

if (nested_svm_check_permissions(svm))
return 1;

Expand All @@ -1884,7 +1885,18 @@ static int vmrun_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
return 1;

if (!nested_svm_vmrun_msrpm(svm))
return 1;
goto failed;

return 1;

failed:

svm->vmcb->control.exit_code = SVM_EXIT_ERR;
svm->vmcb->control.exit_code_hi = 0;
svm->vmcb->control.exit_info_1 = 0;
svm->vmcb->control.exit_info_2 = 0;

nested_svm_vmexit(svm);

return 1;
}
Expand Down

0 comments on commit 1f8da47

Please sign in to comment.