Skip to content

Runtime TDX module update support

Chao Gao kvm linux-coco linux-doc linux-rt-devel lkml 10 versions – Applied

Status from this message: The following commit has been merged into the x86/tdx branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v10 Latest25 patches 16 repliesApplied
  2. v923 patches 44 repliesSuperseded
  3. v821 patches 27 repliesSuperseded
Earlier versions · 7
VersionPostedPatchesRepliesStatus
v722 patches62 repliesSuperseded
v622 patches16 repliesSuperseded
v522 patches57 repliesSuperseded
v424 patches90 repliesSuperseded
v326 patches105 repliesSuperseded
v221 patches98 repliesSuperseded
v1 RFC20 patches43 repliesSuperseded

Patches in v10 Applied

#Subject and filesSizeRepliesApplied
1/25x86/virt/tdx: Clarify try_init_module_global() result cachingarch/x86/virt/vmx/tdx/tdx.c+10 -42 replies
2/25x86/virt/tdx: Move TDX global initialization states to file scopearch/x86/virt/vmx/tdx/tdx.c+4 -32 replies
3/25x86/virt/tdx: Consolidate TDX global initialization statesarch/x86/virt/vmx/tdx/tdx.c+13 -92 replies
4/25x86/virt/tdx: Move TDX_FEATURES0 bits to asm/tdx.harch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/tdx.h+3 -32 replies
5/25x86/virt/tdx: Move low level SEAMCALL helpers out of <asm/tdx.h>arch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/seamcall_internal.h arch/x86/virt/vmx/tdx/tdx.c+111 -920 replies
6/25coco/tdx-host: Introduce a "tdx_host" devicearch/x86/virt/vmx/tdx/tdx.c drivers/virt/coco/Kconfig drivers/virt/coco/Makefile +3 more+52 -10 replies
7/25coco/tdx-host: Expose TDX module versionDocumentation/ABI/testing/sysfs-devices-faux-tdx-host arch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/tdx_global_metadata.c +1 more+37 -20 replies
8/25x86/virt/seamldr: Introduce a wrapper for P-SEAMLDR SEAMCALLsarch/x86/virt/vmx/tdx/Makefile arch/x86/virt/vmx/tdx/seamldr.c+26 -10 replies
9/25x86/virt/seamldr: Add a helper to retrieve P-SEAMLDR informationarch/x86/include/asm/seamldr.h arch/x86/virt/vmx/tdx/seamldr.c+54 -10 replies
10/25coco/tdx-host: Expose P-SEAMLDR information via sysfsDocumentation/ABI/testing/sysfs-devices-faux-tdx-host arch/x86/include/asm/tdx.h drivers/virt/coco/tdx-host/tdx-host.c+98 -10 replies
11/25coco/tdx-host: Don't expose P-SEAMLDR information on CPUs with erratumarch/x86/include/asm/cpufeatures.h arch/x86/include/asm/vmx.h arch/x86/virt/vmx/tdx/tdx.c +1 more+21 -00 replies
12/25coco/tdx-host: Implement firmware upload sysfs ABI for TDX module updatesarch/x86/include/asm/seamldr.h arch/x86/virt/vmx/tdx/seamldr.c drivers/virt/coco/tdx-host/Kconfig +1 more+105 -40 replies
13/25x86/virt/seamldr: Allocate and populate a module update requestarch/x86/virt/vmx/tdx/seamldr.c+144 -11 reply
14/25x86/virt/seamldr: Introduce skeleton for TDX module updatesarch/x86/virt/vmx/tdx/seamldr.c+86 -10 replies
15/25x86/virt/seamldr: Abort updates after a failed steparch/x86/virt/vmx/tdx/seamldr.c+7 -41 reply
16/25x86/virt/seamldr: Shut down the current TDX modulearch/x86/include/asm/tdx_global_metadata.h arch/x86/virt/vmx/tdx/seamldr.c arch/x86/virt/vmx/tdx/tdx.c +2 more+52 -20 replies
17/25x86/virt/tdx: Reset software states during TDX module shutdownarch/x86/virt/vmx/tdx/tdx.c+16 -20 replies
18/25x86/virt/seamldr: Install a new TDX modulearch/x86/virt/vmx/tdx/seamldr.c+14 -00 replies
19/25x86/virt/seamldr: Do TDX global and per-CPU init after module installationarch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/seamldr.c arch/x86/virt/vmx/tdx/tdx.c+6 -10 replies
20/25x86/virt/tdx: Restore TDX module statearch/x86/virt/vmx/tdx/seamldr.c arch/x86/virt/vmx/tdx/tdx.c arch/x86/virt/vmx/tdx/tdx.h+20 -00 replies
21/25x86/virt/tdx: Refresh TDX module version after updatearch/x86/virt/vmx/tdx/tdx.c arch/x86/virt/vmx/tdx/tdx_global_metadata.c+6 -21 reply
22/25x86/virt/tdx: Reject updates during compatibility-sensitive operationsarch/x86/include/asm/tdx.h arch/x86/virt/vmx/tdx/tdx.c drivers/virt/coco/tdx-host/tdx-host.c+32 -52 replies
23/25x86/virt/tdx: Enable TDX module runtime updatesarch/x86/include/asm/tdx.h+2 -20 replies
24/25coco/tdx-host: Document TDX module update compatibility criteriaDocumentation/ABI/testing/sysfs-devices-faux-tdx-host+40 -01 reply
25/25x86/virt/tdx: Document TDX module updateDocumentation/arch/x86/tdx.rst+34 -00 replies

Reviews trailers per patch

23 of 25 patches have a Reviewed-by or Acked-by.

PatchZhenzhong DuanBinbin WuTony LindgrenKiryl Shutsemau (Meta)Xiaoyao LiVishal AnnapurveDave HansenJonathan CameronXu YilunKai HuangRick EdgecombeDan Williams
1/25R-b
2/25R-b R-b
3/25R-b R-b
4/25R-b
5/25R-b R-b R-b R-b R-b R-b A-b
6/25R-b R-b R-b R-b R-b R-b
7/25R-b R-b R-b R-b R-b R-b R-b
8/25R-b R-b R-b R-b R-b R-b
9/25R-b R-b R-b R-b R-b
10/25R-b R-b
11/25R-b R-b R-b R-b
12/25R-b R-b R-b
13/25
14/25R-b R-b R-b R-b R-b
15/25R-b R-b R-b R-b
16/25R-b R-b R-b R-b
17/25R-b R-b R-b
18/25R-b R-b R-b R-b R-b
19/25R-b R-b R-b R-b R-b
20/25R-b R-b R-b R-b
21/25R-b
22/25
23/25R-b R-b R-b R-b
24/25R-b R-b
25/25R-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 12 reviewers.

Read the v10 thread

Cover letter [PATCH v10 00/25] Runtime TDX module update support

Hi Dave & Rick,

Thanks for your thorough review of v9. This v10 addresses the issues you pointed out. The main changes in this version are polishing changelogs and variable renames to improve readability. Specifically:

- Patches 1-2 (new): Split the original "Consolidate TDX global initialization states" into two steps — first move the statics to file scope, then clarify the result-caching logic in try_init_module_global().
- Patch 6: Removed user-facing Kconfig help text for TDX_HOST_SERVICES (now a silent tristate auto-selected by INTEL_TDX_HOST).
- Patch 13: Renamed "size" to "data_len" in seamldr_install_module() and init_seamldr_params(); renamed "HEADER_SIZE" to "TDX_IMAGE_HEADER_SIZE"; renamed "primary" to "is_lead_cpu" in the update state machine.
- Patch 13: Added early data_len validation and explicit bounds checks on sigstruct_nr_pages/module_nr_pages against SEAMLDR_MAX_NR_* limits, removing the implicit clamping in populate_pa_list().
- Patch 22: Fixed BIT(16) -> BIT_ULL(16) for TDX_SYS_SHUTDOWN_AVOID_COMPAT_SENSITIVE.
- Patch 22: Removed unused TDX_FEATURES0_UPDATE_COMPAT definition.
- Various patches: Shortened sysfs ABI descriptions, tightened comments across seamldr.h and seamldr.c, and minor style fixes (return 0 -> return false, unfolded conditionals)

Please take a look at this new version. I hope it can still be merged for 7.2.
---

(For transparency, note that I used AI tools to help proofread this cover-letter and commit messages)

This series adds support for runtime TDX module updates that preserve running TDX guests. It is also available at:

https://github.com/gaochaointel/linux-dev/commits/tdx-module-updates-v10/

== Background ==

Intel TDX isolates Trusted Domains (TDs), or confidential guests, from the host. A key component of Intel TDX is the TDX module, which enforces security policies to protect the memory and CPU states of TDs from the host. However, the TDX module is software that requires updates.

== Problems ==

Currently, the TDX module is loaded by the BIOS at boot time, and the only way to update it is through a reboot, which results in significant system downtime. Users expect the TDX module to be updatable at runtime without disrupting TDX guests.

== Solution ==

On TDX platforms, P-SEAMLDR[1] is a component within the protected SEAM range. It is loaded by the BIOS and provides the host with functions to install a TDX module at runtime.

This series implements runtime TDX module updates through the fw_upload mechanism. That interface is a good fit because TDX module selection is not a simple "load a known file from disk" problem. The update image to load depends on module versioning, compatibility rules. fw_upload lets userspace choose the module explicitly while the kernel provides the update mechanism.

This design intentionally keeps most update validation/policy in userspace. The kernel exposes the information userspace needs, such as TDX module version and P-SEAMLDR information, but userspace is responsible for understanding TDX module's versioning and compatibility rules and for choosing an appropriate update image (see "TDX module versioning" below).

The kernel still enforces the pieces that must be handled in-kernel:

1. Validate the tdx_blob header fields that are not passed through tothe TDX module. Just the standard overflow and reserved bits defensive ABI stuff.

2. Make sure no non-update SEAMCALLs are called during the update.

3. Make sure SEAMCALLs are on the right CPU, for any the user has made available to the kernel.

4. Handle the race between updates and concurrent TD builds by returning -EBUSY to userspace.

Everything else remains a userspace responsibility.

In the unlikely event the update fails, for example userspace picks an incompatible update image, or the image is otherwise corrupted, all TDs will experience SEAMCALL failures and be killed. The recovery of TD operation from that event requires a reboot.

Given there is no mechanism to quiesce SEAMCALLs, the TDs themselves must pause execution over an update. The most straightforward way to meet the 'pause TDs while update executes' constraint is to run the update in stop_machine() context. All other evaluated solutions export more complexity to KVM, or exports more fragility to userspace.

== How to test this series ==

NOTE: This v10 uses a new tdx_blob format. The scripts and module blobs in
https://github.com/intel/tdx-module-binaries have not yet been updated to match this version. Those updates will be done separately later.

== Other information relevant to Runtime TDX module updates ==

=== TDX module versioning ===

Each TDX module is assigned a version number x.y.z, where x represents the "major" version, y the "minor" version, and z the "update" version.

Runtime TDX module updates are restricted to Z-stream releases.

Note that Z-stream releases do not necessarily guarantee compatibility. A new release may not be compatible with all previous versions. To address this, Intel provides a separate file containing compatibility information, which specifies the minimum module version required for a particular update. This information is referenced by the tool to determine if two modules are compatible.

=== TCB Stability ===

Updates change the TCB as viewed by attestation reports. In TDX there is a distinction between "launch-time" version and "current" version where runtime TDX module updates cause that "current" version number to change, subject to Z-stream constraints.

The concern that a malicious host may attack confidential VMs by loading insecure updates was addressed by Alex in [3]. Similarly, the scenario where some "theoretical paranoid tenant" in the cloud wants to audit updates and stop trusting the host after updates until audit completion was also addressed in [4]. Users not in the cloud control the host machine and can manage updates themselves, so they don't have these concerns.

See more about the implications of current TCB version changes in attestation as summarized by Dave in [5].

=== TDX module Distribution Model ===

At a high level, Intel publishes all TDX modules on the github [2], along with a mapping_file.json which documents the compatibility information about each TDX module and a userspace tool to install the TDX module. OS vendors can package these modules and distribute them. Administrators install the package and use the tool to select the appropriate TDX module and install it via the interfaces exposed by this series.

[1]: https://cdrdv2.intel.com/v1/dl/getContent/733584
[2]: https://github.com/intel/tdx-module-binaries
[3]: https://lore.kernel.org/all/[email protected]/
[4]: https://lore.kernel.org/all/[email protected]/
[5]: https://lore.kernel.org/all/[email protected]/

Chao Gao (24):
x86/virt/tdx: Clarify try_init_module_global() result caching x86/virt/tdx: Move TDX global initialization states to file scope x86/virt/tdx: Consolidate TDX global initialization states x86/virt/tdx: Move TDX_FEATURES0 bits to asm/tdx.h coco/tdx-host: Introduce a "tdx_host" device coco/tdx-host: Expose TDX module version
x86/virt/seamldr: Introduce a wrapper for P-SEAMLDR SEAMCALLs x86/virt/seamldr: Add a helper to retrieve P-SEAMLDR information coco/tdx-host: Expose P-SEAMLDR information via sysfs coco/tdx-host: Don't expose P-SEAMLDR information on CPUs with erratum coco/tdx-host: Implement firmware upload sysfs ABI for TDX module
updates
x86/virt/seamldr: Allocate and populate a module update request x86/virt/seamldr: Introduce skeleton for TDX module updates x86/virt/seamldr: Abort updates after a failed step x86/virt/seamldr: Shut down the current TDX module x86/virt/tdx: Reset software states during TDX module shutdown x86/virt/seamldr: Install a new TDX module x86/virt/seamldr: Do TDX global and per-CPU init after module
installation
x86/virt/tdx: Restore TDX module state
x86/virt/tdx: Refresh TDX module version after update x86/virt/tdx: Reject updates during compatibility-sensitive operations x86/virt/tdx: Enable TDX module runtime updates coco/tdx-host: Document TDX module update compatibility criteria x86/virt/tdx: Document TDX module update

Kai Huang (1):
x86/virt/tdx: Move low level SEAMCALL helpers out of <asm/tdx.h>

 .../ABI/testing/sysfs-devices-faux-tdx-host   |  66 ++++
 Documentation/arch/x86/tdx.rst                |  34 ++
 arch/x86/include/asm/cpufeatures.h            |   1 +
 arch/x86/include/asm/seamldr.h                |  36 ++
 arch/x86/include/asm/tdx.h                    |  66 +---
 arch/x86/include/asm/tdx_global_metadata.h    |   4 +
 arch/x86/include/asm/vmx.h                    |   1 +
 arch/x86/virt/vmx/tdx/Makefile                |   2 +-
 arch/x86/virt/vmx/tdx/seamcall_internal.h     | 109 ++++++
 arch/x86/virt/vmx/tdx/seamldr.c               | 324 ++++++++++++++++++
 arch/x86/virt/vmx/tdx/tdx.c                   | 169 +++++----
 arch/x86/virt/vmx/tdx/tdx.h                   |   8 +-
 arch/x86/virt/vmx/tdx/tdx_global_metadata.c   |  17 +-
 drivers/virt/coco/Kconfig                     |   2 +
 drivers/virt/coco/Makefile                    |   1 +
 drivers/virt/coco/tdx-host/Kconfig            |   6 +
 drivers/virt/coco/tdx-host/Makefile           |   1 +
 drivers/virt/coco/tdx-host/tdx-host.c         | 231 +++++++++++++
 18 files changed, 965 insertions(+), 113 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-devices-faux-tdx-host
 create mode 100644 arch/x86/include/asm/seamldr.h
 create mode 100644 arch/x86/virt/vmx/tdx/seamcall_internal.h
 create mode 100644 arch/x86/virt/vmx/tdx/seamldr.c
 create mode 100644 drivers/virt/coco/tdx-host/Kconfig
 create mode 100644 drivers/virt/coco/tdx-host/Makefile
 create mode 100644 drivers/virt/coco/tdx-host/tdx-host.c

base-commit: 5209e5bfe5cab593476c3e7754e42c5e47ce36de

Signature · 1 line
2.52.0