diff options
author | Sean Christopherson <seanjc@google.com> | 2025-02-15 04:06:08 +0300 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2025-02-25 18:10:47 +0300 |
commit | b9595d1ddef883f538563c779fff2151ee040aeb (patch) | |
tree | d7eb46b1828384146ec8d79163546c0a5b309071 | |
parent | 2428865bf0af18f7a0349aee804c21d9bac69bd1 (diff) | |
download | linux-b9595d1ddef883f538563c779fff2151ee040aeb.tar.xz |
KVM: x86: Don't inject PV async #PF if SEND_ALWAYS=0 and guest state is protected
Don't inject PV async #PFs into guests with protected register state, i.e.
SEV-ES and SEV-SNP guests, unless the guest has opted-in to receiving #PFs
at CPL0. For protected guests, the actual CPL of the guest is unknown.
Note, no sane CoCo guest should enable PV async #PF, but the current state
of Linux-as-a-CoCo-guest isn't entirely sane.
Fixes: add5e2f04541 ("KVM: SVM: Add support for the SEV-ES VMSA")
Link: https://lore.kernel.org/r/20250215010609.1199982-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
-rw-r--r-- | arch/x86/kvm/x86.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 263ab2ec6f71..3d84a79583b1 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -13387,7 +13387,7 @@ static bool kvm_can_deliver_async_pf(struct kvm_vcpu *vcpu) return false; if (vcpu->arch.apf.send_user_only && - kvm_x86_call(get_cpl)(vcpu) == 0) + (vcpu->arch.guest_state_protected || !kvm_x86_call(get_cpl)(vcpu))) return false; if (is_guest_mode(vcpu)) { |