From: Xiaoyao Li <xiaoyao.li@intel.com>
To: sashiko-reviews@lists.linux.dev
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: TDX: Enable Notify VM exit
Date: Wed, 5 Aug 2026 12:16:19 +0800 [thread overview]
Message-ID: <cab386d6-ddd1-4768-952b-9b7c05087312@intel.com> (raw)
In-Reply-To: <20260805033851.38FAD1F000E9@smtp.kernel.org>
On 8/5/2026 11:38 AM, sashiko-bot@kernel.org wrote:
>> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
>> index 545b03d9d10b8..cdc0d24657acb 100644
>> --- a/arch/x86/kvm/vmx/tdx.c
>> +++ b/arch/x86/kvm/vmx/tdx.c
> [ ... ]
>> @@ -3157,6 +3160,13 @@ static int tdx_vcpu_init(struct kvm_vcpu *vcpu, struct kvm_tdx_cmd *cmd)
>> td_vmcs_write64(tdx, POSTED_INTR_DESC_ADDR, __pa(&tdx->vt.pi_desc));
>> td_vmcs_setbit32(tdx, PIN_BASED_VM_EXEC_CONTROL, PIN_BASED_POSTED_INTR);
>>
>> + if (kvm_notify_vmexit_enabled(vcpu->kvm)) {
>> + td_vmcs_setbit32(tdx, SECONDARY_VM_EXEC_CONTROL,
>> + SECONDARY_EXEC_NOTIFY_VM_EXITING);
> [Severity: High]
> Does this allow an unprivileged userspace process to trigger a host-side
> KVM_BUG_ON() and crash the host if panic_on_warn is enabled?
>
> If KVM advertises KVM_CAP_X86_NOTIFY_VMEXIT globally based solely on CPU
> hardware support, userspace can enable it for a TDX VM. If the underlying
> TDX module (e.g., v1.0) does not support Notify VM Exiting, this write
> will fail.
>
> When the TDX module write operation fails, the macro backing
> td_vmcs_setbit32() calls tdh_vp_wr_failed(), which triggers a KVM_BUG_ON():
>
> arch/x86/kvm/vmx/tdx.c:tdh_vp_wr_failed() {
> KVM_BUG_ON(1, tdx->vcpu.kvm);
> pr_err("TDH_VP_WR[%s.0x%x]%s0x%llx failed: 0x%llx\n", ...);
> }
>
> Should we verify that the loaded TDX module actually supports the Notify VM
> Exit feature before attempting to program these TD VMCS fields?
Every TDX module should support this feature and SEAMCALLs to set the TD
VMCS will not fail as long as the hardware supports the feature. The
hardware support is checked by KVM and reflected in
kvm_caps.has_notify_vmexit.
If any TDX module doesn't allow to program the TD VMCS fields of Notify
VM exit, it's just a bug of TDX module.
next prev parent reply other threads:[~2026-08-05 4:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 3:12 [PATCH 0/2] KVM: TDX: Enable VM-DoS Prevention Features for TDX Xiaoyao Li
2026-08-05 3:12 ` [PATCH 1/2] KVM: TDX: Enable Notify VM exit Xiaoyao Li
2026-08-05 3:38 ` sashiko-bot
2026-08-05 4:16 ` Xiaoyao Li [this message]
2026-08-06 13:33 ` Nikolay Borisov
2026-08-06 13:50 ` Sean Christopherson
2026-08-07 0:27 ` Edgecombe, Rick P
[not found] ` <anUngktlwsNI6oUM@google.com>
2026-08-07 1:07 ` Xiaoyao Li
2026-08-07 6:46 ` Nikolay Borisov
2026-08-07 1:06 ` Xiaoyao Li
2026-08-05 3:12 ` [PATCH 2/2] KVM: TDX: Enable Bus Lock " Xiaoyao Li
2026-08-05 3:46 ` sashiko-bot
2026-08-05 7:53 ` Xiaoyao Li
2026-08-05 14:56 ` Sean Christopherson
2026-08-06 6:10 ` Xiaoyao Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cab386d6-ddd1-4768-952b-9b7c05087312@intel.com \
--to=xiaoyao.li@intel.com \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox