Build a TDX confidential computing environment and verify remote attestation

更新时间:
复制 MD 格式

This topic describes how to build a TDX confidential computing environment on an ECS instance that is based on Intel®Trusted Domain Extension (Intel®TDX), which is referred to as a TDX instance, and how to run test cases to verify TDX capabilities.

Background

Intel® TDX is a hardware-based protection technology for ECS instances. In a TDX instance, CPU registers, memory data, interrupt handling, and other runtime states are confidentially protected by the CPU hardware. Neither cloud providers nor external attackers can monitor or tamper with the internal runtime state of a TDX instance, such as running processes and sensitive data during computation. See Intel® Trusted Domain Extension (Intel® TDX).

Intel® TDX secures instances and applications by default. Existing applications can migrate to TDX instances without redevelopment.

image

Prerequisites

Console

Creating a TDX instance is similar to creating a standard instance. Only TDX-specific configurations are described here. For general configurations, see Create an instance on a custom basis.

  1. Go to ECS console - Instances.

  2. In the upper-left corner of the page, select a region and resource group.

  3. Click Create Instance and configure the following parameters.

    Parameter

    Description

    Region and zone

    Supported regions and zones vary by instance type. See Supported regions, instance types, and images.

    This example uses China (Beijing) Zone I and ecs.g8i.xlarge.

    Instance type

    Image

    Select the Confidential VM checkbox, and then select the Alibaba Cloud Linux 3.2104 LTS 64-bit image.

  4. Complete the remaining configurations to create the instance.

CLI and API

Call the RunInstances operation or use Alibaba Cloud CLI to create a TDX-enabled ECS instance. Configure the following parameters.

Parameter

Description

Example

RegionId

China (Beijing)

cn-beijing

ZoneId

Available only in specific zones. Instance types vary by zone. See Supported regions, instance types, and images.

cn-beijing-i

InstanceType

ecs.g8i.2xlarge

ImageId

ID of a TDX-supported image. Only Alibaba Cloud Linux 3.2104 LTS 64-bit UEFI images with kernel 5.10.134-16.al8.x86_64 or later are supported.

aliyun_3_x64_20G_alibase_20241218.vhd

SecurityOptions.ConfidentialComputingMode

The confidential computing mode.

TDX

CLI example

aliyun ecs RunInstances \
  --SecurityOptions.ConfidentialComputingMode TDX \
  --Region cn-beijing \
  --ZoneId cn-beijing-i \
  --SystemDisk.Category cloud_essd \
  --ImageId 'aliyun_3_x64_20G_alibase_20241218.vhd' \
  --InstanceType 'ecs.g8i.2xlarge' \
  --SecurityGroupId 'sg-<YourSecurityGroupId>' \
  --VSwitchId 'vsw-<YourVSwitchId>' \
  --KeyPairName <YourKeyPairName> \
  

Procedure

Step 1: Verify that TDX is enabled

Verify that TDX is enabled on your instance before proceeding.

  1. Check if TDX is enabled.

    lscpu |grep -i tdx_guest

    If the output contains tdx_guest, TDX is enabled.

    [root@iZwzxxxxxxxx:~]# lscpu |grep -i tdx_guest
    Flags:           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc bts rep_good nopl xtopology tsc_known_freq pni pclmulqdq dtes64 ds_cpl ssse3 sdbg fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single sbd ibrs ibpb stibp ibrs_enhanced tdx_guest fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm avx512f avx512dq rdseed adx smap avx512ifma clflushopts clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx_vnni avx512_bf16 wbnoinvd avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid bus_lock_detect cldemote movdiri movdir64b _vp2intersect md_clear serialize tsxldtrk amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities
  2. Check the available attestation report interface.

    The kernel exposes the TDX attestation reports (TD Report and Quote) to user mode, and the interface differs by kernel version. Select a check command that matches the kernel version of the image. Passing either check is sufficient.

    Interface

    Applicable images and kernels

    Check command

    ConfigFS TSM /sys/kernel/config/tsm/report

    Alibaba Cloud Linux 4, Ubuntu 24.04, Debian 13, and Rocky 9.5 or later (upstream kernel 6.7 or later)

    ls -d /sys/kernel/config/tsm/report

    Character device /dev/tdx_guest

    Alibaba Cloud Linux 3 (kernel 5.10.134-16.al8 or later)

    ls -l /dev/tdx_guest

Step 2: Use TDX confidential computing capabilities

TDX provides four atomic capabilities to user mode, which together form a complete chain from local measurement to remote verification.

Capability

Description

Purpose

TD Report generation

A local attestation structure returned by the TDX Module. It has a fixed size of 1,024 bytes and can bind the 64-byte REPORTDATA supplied by the caller.

Obtain local measurements, and bind freshness by using a nonce or a public key hash.

Quote generation

The Quoting Enclave signs the TD Report and embeds the PCK certificate chain, which produces a credential that a remote party can verify independently.

Prove the identity and runtime state of the instance to a remote party.

Quote verification

Verifies the ECDSA signature and the certificate chain, and retrieves collateral such as TCB Info, QE Identity, and PCK CRL as needed to check the platform TCB level and the revocation status.

Verify that a Quote is authentic.

Measurement register read and extension

Reads MRTD and RTMR[0-3], parses the ACPI CCEL event log and replays it against RTMR[0-3] for comparison, and extends custom measurements into RTMR[2] and RTMR[3].

Verify the integrity of the boot chain, and include application-layer events in measurements.

The OpenAnolis community provides the tdx-lab command-line tool in go-tdx-guest. Its test cases cover the four capabilities described above. The following steps show how to run those test cases.

  1. Obtain and build the tool.

    sudo yum install -y git golang
    git clone https://gitee.com/anolis/go-tdx-guest.git
    cd go-tdx-guest/tools/tdx-lab
    go build -o tdx-lab .
    Note

    For Debian and Ubuntu images, run sudo apt install -y git golang-go instead.

  2. Obtain the Alibaba Cloud PCCS address of the region in which the instance resides.

    token=$(curl -s -X PUT -H "X-aliyun-ecs-metadata-token-ttl-seconds: 5" "http://100.100.100.200/latest/api/token")
    region_id=$(curl -s -H "X-aliyun-ecs-metadata-token: $token" http://100.100.100.200/latest/meta-data/region-id)
    PCCS_HOST=sgx-dcap-server-vpc.${region_id}.aliyuncs.com
  3. Run the test cases.

    # Run all test cases
    ./tdx-lab --skip-early --pccs-url ${PCCS_HOST}
    Note

    The TCB status is not guaranteed to be UpToDate, so a Strict Tcb Check failure in some scenarios is expected. For the full parameter list and a description of each test case, see tools/tdx-lab/README.md.

Supported regions, instance types, and images

Region and instance type limitations

Confidential computing is available only in specific zones. Supported instance types vary by zone.

Region and zone

Instance types

China (Beijing) Zone L

ecs.g8i.xlarge and larger

China (Beijing) Zone I

  • ecs.g8i.xlarge and larger

  • ecs.g9i.xlarge, ecs.c9i.xlarge, ecs.r9i.xlarge, and larger

  • ebmg8i instance family

China (Hangzhou) Zone J

ecs.r9i.xlarge and larger

China (Hong Kong) Zone B

ecs.g8i.xlarge and larger

China (Hong Kong) Zone C

ecs.g8i.xlarge and larger

China (Hong Kong) Zone D

ecs.g8i.xlarge and larger

Singapore Zone B

ecs.g8i.xlarge and larger

Images

Important

We recommend that you use Alibaba Cloud Linux 3.

  • Debian 13.1 or later: Debian 13.1, Debian 13.2, Debian 13.3.

  • Rocky 9.5 or later: Rocky 9.5, Rocky 9.6, Rocky 9.7, Rocky 10.0, Rocky 10.1.

  • Ubuntu 24.04 or later: Ubuntu 24.04.

  • Alibaba Cloud Linux 3 or later: Alibaba Cloud Linux 3, Alibaba Cloud Linux 4.

Limitations

  • TDX instances may have lower performance than regular instances because CPU registers and memory data are encrypted by CPU hardware.

  • Due to RTMR resets, interrupt protection, and register state recovery, TDX instances do not support in-OS reboots. You cannot run the reboot command inside the OS.

  • VNC logon is not supported. Use SSH via Workbench or a third-party client instead. For runtime logs, see View instance system logs and screenshots or GetInstanceConsoleOutput.

  • Image limitations:

    • Only UEFI images are supported.

    • Windows is not supported.

    • Images with outdated kernels are not supported. Kernel version must be 5.10.134-16.al8.x86_64 or later.

  • eRDMA and various types of accelerators are not supported.

  • Known issues with the Linux guest kernel SWIOTLB buffer:

    • Less memory is visible to the OS compared to a regular instance. A TDX instance reserves unencrypted memory (SWIOTLB) for peripheral communication. By default, this area is 6% of available memory, up to 1 GiB.

    • Attaching multiple elastic network interfaces (ENIs) to a large instance may cause a crash due to insufficient SWIOTLB memory in multi-queue network card scenarios. Stop the instance on the console and detach ENIs to recover.

    • High-I/O workloads may experience performance degradation from insufficient SWIOTLB. Check with:

      dmesg| grep 'swiotlb buffer is full'
      Important

      Incorrect SWIOTLB settings may cause boot failure. Create a snapshot before proceeding so you can roll back if errors occur.

      If this issue occurs, increase the SWIOTLB size:

      • Set the SWIOTLB size to 1 GiB.

        grubby --update-kernel=ALL --args=swiotlb=524288
      • For kernel versions later than 5.10.134-18.al8.x86_64, add the any parameter to support larger SWIOTLB sizes:

        grubby --update-kernel=ALL --args=swiotlb=2097152,any   # Sets SWIOTLB to 4 GiB.
        Note

        Calculate the SWIOTLB parameter value: Target size (in MiB) × 512. See The kernel's command-line parameters.

Best Practices

For more guidance on TDX confidential computing environments, refer to the following best practices based on your specific business scenarios. These resources cover application building, disk protection, and containerized deployment strategies.