KVM/nSVM: properly map nested VMCB
PATCH 1/1 KVM/nSVM: properly map nested VMCB
Commit 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest memory") broke nested SVM completely: kvm_vcpu_map()'s second parameter is GFN so vmcb_gpa needs to be converted with gpa_to_gfn(), not the other way around.
--- arch/x86/kvm/svm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/svm.c +2 -2
@@ -3293,7 +3293,7 @@ static int nested_svm_vmexit(struct vcpu_svm *svm) vmcb->control.exit_int_info_err, KVM_ISA_SVM); - rc =kvm_vcpu_map (&svm->vcpu,gfn_to_gpa (svm->nested.vmcb), &map); + rc =kvm_vcpu_map (&svm->vcpu,gpa_to_gfn (svm->nested.vmcb), &map);if (rc) {if (rc == -EINVAL )kvm_inject_gp (&svm->vcpu,0 );
@@ -3583,7 +3583,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm) vmcb_gpa = svm->vmcb->save.rax; - rc =kvm_vcpu_map (&svm->vcpu,gfn_to_gpa (vmcb_gpa), &map); + rc =kvm_vcpu_map (&svm->vcpu,gpa_to_gfn (vmcb_gpa), &map);if (rc) {if (rc == -EINVAL )kvm_inject_gp (&svm->vcpu,0 );
Signature · 1 line
2.20.1
Quoted 7 lines · Vitaly Kuznetsov
Commit
8c5fbf1a7231("KVM/nSVM: Use the new mapping API for mapping guest memory") broke nested SVM completely: kvm_vcpu_map()'s second parameter is GFN sovmcb_gpaneeds to be converted withgpa_to_gfn(), not the other way around.Fixes 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest memory")Signed-off-by Vitaly Kuznetsov <[email protected]>
Paolo Bonzini
maintainerQuoted 26 lines · Vitaly Kuznetsov
Commit
8c5fbf1a7231("KVM/nSVM: Use the new mapping API for mapping guest memory") broke nested SVM completely: kvm_vcpu_map()'s second parameter is GFN sovmcb_gpaneeds to be converted withgpa_to_gfn(), not the other way around.Fixes 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest memory")Signed-off-by Vitaly Kuznetsov <[email protected]>--- arch/x86/kvm/svm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/svm.c +1
-1@@ -3293,7 +3293,7 @@ static int nested_svm_vmexit(struct vcpu_svm *svm) vmcb->control.exit_int_info_err, KVM_ISA_SVM); - rc =kvm_vcpu_map (&svm->vcpu,gfn_to_gpa (svm->nested.vmcb), &map); + rc =kvm_vcpu_map (&svm->vcpu,gpa_to_gfn (svm->nested.vmcb), &map);if (rc) {if (rc == -EINVAL )kvm_inject_gp (&svm->vcpu,0 );
arch/x86/kvm/svm.c static bool nested_svm_vmrun(struct vcpu_svm *svm) · line 3589
Quoted 8 lines
arch/x86/kvm/svm.c +1
-1@@ -3583,7 +3583,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm) vmcb_gpa = svm->vmcb->save.rax; - rc =kvm_vcpu_map (&svm->vcpu,gfn_to_gpa (vmcb_gpa), &map); + rc =kvm_vcpu_map (&svm->vcpu,gpa_to_gfn (vmcb_gpa), &map);if (rc) {if (rc == -EINVAL )kvm_inject_gp (&svm->vcpu,0 );
Oops. Queued, thanks.
Paolo
Hello,
Quoted 29 lines · Paolo Bonzini
Quoted 28 lines · Vitaly Kuznetsov
Commit
8c5fbf1a7231("KVM/nSVM: Use the new mapping API for mapping guest memory") broke nested SVM completely: kvm_vcpu_map()'s second parameter is GFN sovmcb_gpaneeds to be converted withgpa_to_gfn(), not the other way around.Fixes 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest memory")Signed-off-by Vitaly Kuznetsov <[email protected]>--- arch/x86/kvm/svm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/svm.c +1
-1@@ -3293,7 +3293,7 @@ static int nested_svm_vmexit(struct vcpu_svm *svm) vmcb->control.exit_int_info_err, KVM_ISA_SVM); - rc =kvm_vcpu_map (&svm->vcpu,gfn_to_gpa (svm->nested.vmcb), &map); + rc =kvm_vcpu_map (&svm->vcpu,gpa_to_gfn (svm->nested.vmcb), &map);if (rc) {if (rc == -EINVAL )kvm_inject_gp (&svm->vcpu,0 );@@ -3583,7 +3583,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm) vmcb_gpa = svm->vmcb->save.rax;
Quoted 7 lines
arch/x86/kvm/svm.c static bool nested_svm_vmrun(struct vcpu_svm *svm) · line 3589
Quoted 6 lines
arch/x86/kvm/svm.c +1
-1- rc =kvm_vcpu_map (&svm->vcpu,gfn_to_gpa (vmcb_gpa), &map); + rc =kvm_vcpu_map (&svm->vcpu,gpa_to_gfn (vmcb_gpa), &map);if (rc) {if (rc == -EINVAL )kvm_inject_gp (&svm->vcpu,0 );Oops. Queued, thanks.
Given that this fix didn't make it to 5.2, and its straightforwardness, could you send it to stable for inclusion?
Regards
Jiri Palecek
Paolo Bonzini
maintainerQuoted 44 lines · Jiri Palecek
Hello,
Quoted 33 lines · Paolo Bonzini
Quoted 32 lines · Vitaly Kuznetsov
Commit
8c5fbf1a7231("KVM/nSVM: Use the new mapping API for mapping guest
memory") broke nested SVM completely: kvm_vcpu_map()'s second parameter is
GFN sovmcb_gpaneeds to be converted withgpa_to_gfn(), not the other way
around.Fixes 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mappingguest memory")
Signed-off-by Vitaly Kuznetsov <[email protected]>---
arch/x86/kvm/svm.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/kvm/svm.c +1
-1@@ -3293,7 +3293,7 @@ static int nested_svm_vmexit(struct vcpu_svm *svm) vmcb->control.exit_int_info_err, KVM_ISA_SVM); - rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(svm->nested.vmcb), &map); + rc = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(svm->nested.vmcb), &map); if (rc) { if (rc == -EINVAL) kvm_inject_gp(&svm->vcpu, 0);@@ -3583,7 +3583,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm) vmcb_gpa = svm->vmcb->save.rax;Quoted 7 lines
arch/x86/kvm/svm.c static bool nested_svm_vmrun(struct vcpu_svm *svm) · line 3589
Quoted 6 lines
arch/x86/kvm/svm.c +1
-1- rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(vmcb_gpa), &map); + rc = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb_gpa), &map); if (rc) { if (rc == -EINVAL) kvm_inject_gp(&svm->vcpu, 0);Oops. Queued, thanks.
Quoted 2 lines
Given that this fix didn't make it to 5.2, and its straightforwardness, could you send it to stable for inclusion?
Done, thanks for the reminder!
Paolo