Skip to content

Commit b9595d1

Browse files
committed
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: add5e2f ("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>
1 parent 2428865 commit b9595d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/x86.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13387,7 +13387,7 @@ static bool kvm_can_deliver_async_pf(struct kvm_vcpu *vcpu)
1338713387
return false;
1338813388

1338913389
if (vcpu->arch.apf.send_user_only &&
13390-
kvm_x86_call(get_cpl)(vcpu) == 0)
13390+
(vcpu->arch.guest_state_protected || !kvm_x86_call(get_cpl)(vcpu)))
1339113391
return false;
1339213392

1339313393
if (is_guest_mode(vcpu)) {

0 commit comments

Comments
 (0)