Re: [PATCH v2 3/3] KVM: TDX: Ratelimit the "EPT Violation on pending acceptance page" warning
From: Yan Zhao
Date: Wed Oct 07 2026 - 23:09:55 EST
On Tue, Sep 29, 2026 at 05:11:27PM -0700, Sean Christopherson wrote:
> Ratelimit TDX's kernel logging when a guest accesses an unaccepted page and
> has opted to disable EPT Violation #VEs for unaccepted accesses, as the
> pr_warn() is trivial for a misbehaving userspace to trigger.
Since the pr_warn() is previously accompanied by a kvm_vm_dead(), which kicks
off all vCPUs and disallows re-entry, a misbehaving guest should not be able to
trigger pr_warn() more than once.
Or are you concerned about the pr_warn() being triggered by multiple misbehaving
guests? But would it be better to print for each guest?
> Fixes: e6a85781f783 ("KVM: TDX: Detect unexpected SEPT violations due to pending SPTEs")
> Cc: stable@xxxxxxxxxxxxxxx
> Reported-by: Sashiko Bot <sashiko-bot@xxxxxxxxxx>
> Closes: https://lore.kernel.org/all/20260923164348.2DB2D1F000FF@xxxxxxxxxxxxxxx
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> ---
> arch/x86/kvm/vmx/tdx.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index e3723f1222fc..4cac43299851 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -1937,8 +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);
> + pr_warn_ratelimited("Guest access before accepting 0x%llx on vCPU %d\n",
> + gpa, vcpu->vcpu_id);
> kvm_prepare_shutdown_exit(vcpu);
> return 0;
> }
> --
> 2.56.0.rc1.315.gc6ed9934b7-goog
>