From: Paul Meyer Date: Tue, 23 Jun 2026 10:34:12 +0000 (+0200) Subject: boot: read the TDX CPUID leaf unconditionally X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c433f39454d19e7913f14669c5883d8b41e716d;p=thirdparty%2Fsystemd.git boot: read the TDX CPUID leaf unconditionally vmm.c carries the confidential-VM detection used by sd-boot/sd-stub. Its detect_tdx() had the same dead guard as the userspace copy: it gated the 0x21 read on CPUID_GET_HIGHEST_FUNCTION (0x80000000, the extended max function), which is always >= 0x80000000, so the guard never held. Mirror the userspace fix: read leaf 0x21 directly and rely on the IntelTDX signature, matching the kernel. An out-of-range CPUID leaf returns the highest basic leaf's data (no fault), and 0x21 is a synthetic TDX leaf whose presence need not be reflected in the max basic function, so it must not be gated on it. Ref: Linux 59bd54a84d15 ("x86/tdx: Detect running as a TDX guest in early boot"), arch/x86/coco/tdx/tdx.c:1119 (tdx_early_init()). Signed-off-by: Paul Meyer --- diff --git a/src/boot/vmm.c b/src/boot/vmm.c index 902f61b41c2..e571a3990de 100644 --- a/src/boot/vmm.c +++ b/src/boot/vmm.c @@ -225,14 +225,10 @@ static bool detect_sev(void) { } static bool detect_tdx(void) { - uint32_t eax, ebx, ecx, edx; char sig[13] = {}; - __cpuid(CPUID_GET_HIGHEST_FUNCTION, eax, ebx, ecx, edx); - - if (eax < CPUID_INTEL_TDX_ENUMERATION) - return false; - + /* Querying an unsupported CPUID leaf is harmless (it returns the highest basic leaf's data rather + * than faulting), so reading this leaf and matching the IntelTDX signature is sufficient. */ cpuid_leaf(CPUID_INTEL_TDX_ENUMERATION, sig, true); if (memcmp(sig, CPUID_SIG_INTEL_TDX, sizeof(sig)) == 0)