From: Challvy Tee <challvy.tee@gmail.com>
To: challvy.tee@gmail.com
Cc: stable@vger.kernel.org
Subject: [PATCH] x86/virt/tdx: Skip TDH.SYS.DISABLE if the TDX module is not initialized
Date: Thu, 29 Oct 2026 16:07:31 +0800 [thread overview]
Message-ID: <20261029080731.890996-1-challvy.tee@gmail.com> (raw)
Commit XXXXXXXXXXXX ("x86/tdx: Disable the TDX module during kexec and
kdump") made native_machine_crash_shutdown() call tdx_sys_disable(), but
tdx_sys_disable() has no runtime gate: its only guard is compile time
(CONFIG_INTEL_TDX_HOST), which distribution kernels enable. On a system
where the TDX module was never initialized, kdump now issues a
TDH.SYS.DISABLE SEAMCALL that it did not issue before, and the crashing
CPU stops making forward progress before machine_kexec(). The capture
kernel is never entered, no vmcore is written and nothing reaches the
console, so kdump is completely non-functional.
Having the TDX module uninitialized is an ordinary state rather than an
error. tdx_enable() returns -ENODEV early when
X86_FEATURE_TDX_HOST_PLATFORM is absent, and it also bails out if
init_tdx_module() fails. Any guest whose host does not expose TDX is in
this state and logs:
virt/tdx: TDX not supported by the host platform
The syscore path is implicitly protected: register_syscore() only runs
after init_tdx_module() succeeds, so tdx_shutdown() cannot be reached on
an uninitialized system. That covers kexec, suspend and resume, which is
why only kdump regressed.
The crash path calls tdx_sys_disable() directly and bypasses that
protection.
Where the CPU has no SEAM support the SEAMCALL raises #UD, which the
exception table entry in tdxcall.S turns into TDX_SEAMCALL_UD, so
tdx_sys_disable() just returns and kdump still works. On SEAM capable
platforms the observed behaviour is the hang described above.
Reproduced with 'echo c > /proc/sysrq-trigger' in VM guests running on
Intel Sapphire Rapids, Emerald Rapids and Granite Rapids platforms.
Before this change no vmcore is produced; after it, kdump completes
normally. Guests without SEAM support, and plain kexec everywhere, were
unaffected both before and after, matching the asymmetry above.
Gate the SEAMCALL on tdx_module_state.initialized, the same predicate
tdx_get_sysinfo() already uses in this file. Putting the check inside
tdx_sys_disable() rather than at the crash.c call site also covers the
syscore caller and any future caller.
Fixes: XXXXXXXXXXXX ("x86/tdx: Disable the TDX module during kexec and kdump")
Cc: stable@vger.kernel.org
Signed-off-by: Challvy Tee <challvy.tee@gmail.com>
---
arch/x86/virt/vmx/tdx/tdx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
index 96ced0494b68..a7eae7492c1e 100644
--- a/arch/x86/virt/vmx/tdx/tdx.c
+++ b/arch/x86/virt/vmx/tdx/tdx.c
@@ -2321,6 +2321,9 @@ void tdx_sys_disable(void)
struct tdx_module_args args = {};
u64 ret;
+ if (!tdx_module_state.initialized)
+ return;
+
/*
* Don't loop forever.
*
--
2.52.0
next reply other threads:[~2026-10-29 8:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 8:07 Challvy Tee [this message]
2026-10-29 9:47 ` [PATCH v2] x86/virt/tdx: Skip TDH.SYS.DISABLE if the TDX module is not initialized Challvy Tee
2026-10-29 12:10 ` Kiryl Shutsemau
2026-10-30 15:48 ` [PATCH v3] " Challvy Tee
2026-10-30 16:13 ` Dave Hansen
2026-10-30 16:26 ` Kiryl Shutsemau
2026-10-30 16:38 ` Dave Hansen
2026-11-02 7:32 ` [PATCH v4] " Challvy Tee
2026-11-02 9:42 ` Kiryl Shutsemau
2026-11-02 19:28 ` Edgecombe, Rick P
2026-11-02 22:24 ` Verma, Vishal L
2026-11-03 2:16 ` [PATCH v5] x86/virt/tdx: Gate TDH.SYS.DISABLE on X86_FEATURE_TDX_HOST_PLATFORM Challvy Tee
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=20261029080731.890996-1-challvy.tee@gmail.com \
--to=challvy.tee@gmail.com \
--cc=stable@vger.kernel.org \
/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