]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: nVMX: handle page fault in vmread
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 13 Sep 2019 22:26:27 +0000 (00:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Sep 2019 07:11:00 +0000 (09:11 +0200)
commit f7eea636c3d505fe6f1d1066234f1aaf7171b681 upstream.

The implementation of vmread to memory is still incomplete, as it
lacks the ability to do vmread to I/O memory just like vmptrst.

Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/vmx/nested.c

index b96723294b2f39d72801c0a0bfb2b115cb7dfd3b..36a287147a7311a6e8e5c305874f7243975ea499 100644 (file)
@@ -4411,6 +4411,7 @@ static int handle_vmread(struct kvm_vcpu *vcpu)
        int len;
        gva_t gva = 0;
        struct vmcs12 *vmcs12;
+       struct x86_exception e;
 
        if (!nested_vmx_check_permission(vcpu))
                return 1;
@@ -4451,7 +4452,8 @@ static int handle_vmread(struct kvm_vcpu *vcpu)
                                vmx_instruction_info, true, len, &gva))
                        return 1;
                /* _system ok, nested_vmx_check_permission has verified cpl=0 */
-               kvm_write_guest_virt_system(vcpu, gva, &field_value, len, NULL);
+               if (kvm_write_guest_virt_system(vcpu, gva, &field_value, len, &e))
+                       kvm_inject_page_fault(vcpu, &e);
        }
 
        return nested_vmx_succeed(vcpu);