KVM: x86: Sanity check inputs to kvm_handle_memory_failure()
authorSean Christopherson <seanjc@google.com>
Tue, 20 Dec 2022 15:34:27 +0000 (15:34 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 23 Dec 2022 17:15:25 +0000 (12:15 -0500)
commit77b1908e10eccf34310ffd95b0b455c01aa76286
tree025e2b93563d578c91a3bbed9ff034ee97fffc8f
parent3c649918b764c0aaef22ea65d514bac5e2324ec0
KVM: x86: Sanity check inputs to kvm_handle_memory_failure()

Add a sanity check in kvm_handle_memory_failure() to assert that a valid
x86_exception structure is provided if the memory "failure" wants to
propagate a fault into the guest.  If a memory failure happens during a
direct guest physical memory access, e.g. for nested VMX, KVM hardcodes
the failure to X86EMUL_IO_NEEDED and doesn't provide an exception pointer
(because the exception struct would just be filled with garbage).

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20221220153427.514032-1-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c