Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-08-16 22:01:45 +0200
committerJiri Slaby <jslaby@suse.cz>2019-08-16 22:25:10 +0200
commit2545795f3dca513c1b937923b3e4a288ff2145ad (patch)
tree47988c7fe8f9fae18f40f9b8181877150476517e
parentccdbfec289fa0bc6c0cc50e7a627b49c9145663c (diff)
KVM/nSVM: properly map nested VMCB (bnc#1012628).
-rw-r--r--patches.kernel.org/5.2.9-120-KVM-nSVM-properly-map-nested-VMCB.patch49
-rw-r--r--series.conf1
2 files changed, 50 insertions, 0 deletions
diff --git a/patches.kernel.org/5.2.9-120-KVM-nSVM-properly-map-nested-VMCB.patch b/patches.kernel.org/5.2.9-120-KVM-nSVM-properly-map-nested-VMCB.patch
new file mode 100644
index 0000000000..c700fb5e09
--- /dev/null
+++ b/patches.kernel.org/5.2.9-120-KVM-nSVM-properly-map-nested-VMCB.patch
@@ -0,0 +1,49 @@
+From: Vitaly Kuznetsov <vkuznets@redhat.com>
+Date: Tue, 4 Jun 2019 18:09:39 +0200
+Subject: [PATCH] KVM/nSVM: properly map nested VMCB
+References: bnc#1012628
+Patch-mainline: 5.2.9
+Git-commit: 8f38302c0be2d2daf3b40f7d2142ec77e35d209e
+
+commit 8f38302c0be2d2daf3b40f7d2142ec77e35d209e upstream.
+
+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.
+
+Fixes: 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest memory")
+Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
+Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/kvm/svm.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
+index 48c865a4e5dd..3be96ed7f666 100644
+--- a/arch/x86/kvm/svm.c
++++ b/arch/x86/kvm/svm.c
+@@ -3290,7 +3290,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);
+@@ -3580,7 +3580,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);
+--
+2.22.0
+
diff --git a/series.conf b/series.conf
index 6cd2c59e2f..90832c0021 100644
--- a/series.conf
+++ b/series.conf
@@ -1140,6 +1140,7 @@
patches.kernel.org/5.2.9-117-gen_compile_commands-lower-the-entry-count-thre.patch
patches.kernel.org/5.2.9-118-HID-sony-Fix-race-condition-between-rumble-and-.patch
patches.kernel.org/5.2.9-119-ALSA-usb-audio-fix-a-memory-leak-bug.patch
+ patches.kernel.org/5.2.9-120-KVM-nSVM-properly-map-nested-VMCB.patch
########################################################
# Build fixes that apply to the vanilla kernel too.