[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aImzwgbuZniu31/V@yzhao56-desk.sh.intel.com>
Date: Wed, 30 Jul 2025 13:55:14 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
CC: "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>, "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, Jul 29, 2025 at 10:27:34PM +0000, Edgecombe, Rick P wrote:
> 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?
Sean's commit 6385d01eec16 ("KVM: x86/mmu: Don't overwrite shadow-present MMU
SPTEs when prefaulting") should have prevented repeated invocation of
set_external_spte_present() with prefaulted entries.
Powered by blists - more mailing lists