KVM: x86/mmu: Exit to userspace with -EFAULT if private fault hits emulation
authorSean Christopherson <seanjc@google.com>
Wed, 28 Feb 2024 02:41:32 +0000 (18:41 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 7 May 2024 15:59:16 +0000 (11:59 -0400)
commitd0bf8e6e440aef6a4fb7ef05671390529f447bb8
tree9f600f18fd3b0d83672967ccb04c529b2f758339
parenta96cb3bf390eebfead5fc7a2092f8452a7997d1b
KVM: x86/mmu: Exit to userspace with -EFAULT if private fault hits emulation

Exit to userspace with -EFAULT / KVM_EXIT_MEMORY_FAULT if a private fault
triggers emulation of any kind, as KVM doesn't currently support emulating
access to guest private memory.  Practically speaking, private faults and
emulation are already mutually exclusive, but there are many flow that
can result in KVM returning RET_PF_EMULATE, and adding one last check
to harden against weird, unexpected combinations and/or KVM bugs is
inexpensive.

Suggested-by: Yan Zhao <yan.y.zhao@intel.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-ID: <20240228024147.41573-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/mmu_internal.h