]> asedeno.scripts.mit.edu Git - 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)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 14 Sep 2019 07:25:02 +0000 (09:25 +0200)
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>
arch/x86/kvm/vmx/nested.c

index ced9fba32598d8435ef9f1d59e963f5c3e134d20..a3cba321b5c5ddb7b2730835c01635c0307e1bb1 100644 (file)
@@ -4540,6 +4540,7 @@ static int handle_vmread(struct kvm_vcpu *vcpu)
        int len;
        gva_t gva = 0;
        struct vmcs12 *vmcs12;
+       struct x86_exception e;
        short offset;
 
        if (!nested_vmx_check_permission(vcpu))
@@ -4588,7 +4589,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);