[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1d9d6e35ebf4658bbe48e6273eefff3267759519.camel@intel.com>
Date: Tue, 29 Jul 2025 22:27:34 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "maz@...nel.org" <maz@...nel.org>, "pbonzini@...hat.com"
<pbonzini@...hat.com>, "seanjc@...gle.com" <seanjc@...gle.com>,
"oliver.upton@...ux.dev" <oliver.upton@...ux.dev>
CC: "Annapurve, Vishal" <vannapurve@...gle.com>, "Li, Xiaoyao"
<xiaoyao.li@...el.com>, "kvmarm@...ts.linux.dev" <kvmarm@...ts.linux.dev>,
"Hunter, Adrian" <adrian.hunter@...el.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "kvm@...r.kernel.org"
<kvm@...r.kernel.org>, "nik.borisov@...e.com" <nik.borisov@...e.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/5] KVM: TDX: Exit with MEMORY_FAULT on unexpected
pending S-EPT Violation
On Tue, 2025-07-29 at 12:33 -0700, Sean Christopherson wrote:
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index 3e0d4edee849..c2ef03f39c32 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -1937,10 +1937,8 @@ static int tdx_handle_ept_violation(struct kvm_vcpu *vcpu)
>
> if (vt_is_tdx_private_gpa(vcpu->kvm, gpa)) {
> if (tdx_is_sept_violation_unexpected_pending(vcpu)) {
> - pr_warn("Guest access before accepting 0x%llx on vCPU %d\n",
> - gpa, vcpu->vcpu_id);
> - kvm_vm_dead(vcpu->kvm);
> - return -EIO;
> + kvm_prepare_memory_fault_exit(vcpu, gpa, 0, true, false, true);
> + return -EFAULT;
> }
> /*
> * Always treat SEPT violations as write faults. Ignore the
The vm_dead was added because mirror EPT will KVM_BUG_ON() if there is an
attempt to set the mirror EPT entry when it is already present. And the
unaccepted memory access will trigger an EPT violation for a mirror PTE that is
already set. I think this is a better solution irrespective of the vm_dead
changes.
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@...el.com>
But hmm, tangentially related, but Yan do we have a similar problem with
KVM_PRE_FAULT_MEMORY after we started setting pre_fault_allowed during TD
finalization?
Powered by blists - more mailing lists