This guide describes how to build a heterogeneous confidential computing environment on an Alibaba Cloud heterogeneous confidential computing instance (gn8v-tee) and run sample code to verify the GPU confidential computing feature.
Background
An Alibaba Cloud heterogeneous confidential computing instance (gn8v-tee) builds on a CPU TDX confidential computing instance by adding a GPU to the Trusted Execution Environment (TEE). This protects data transfers between the CPU and GPU, and computation on the GPU. This topic focuses on verifying GPU confidential computing features. For information about building a CPU TDX confidential computing environment and verifying its remote attestation capability, see Build TDX environment. To deploy a large language model (LLM) inference environment on a heterogeneous confidential computing instance, see Measured LLM inference on confidential instance.
As shown in the figure, the GPU on a heterogeneous confidential computing instance starts in confidential computing mode. The following mechanisms ensure the confidentiality of the instance:
-
The TDX feature ensures that the Hypervisor/Host OS cannot access the instance's sensitive registers or memory data.
-
A PCIe firewall prevents the CPU from accessing the GPU's critical registers and protected video memory. The Hypervisor/Host OS can perform only limited operations on the GPU, such as resetting it, but cannot access sensitive data.
-
The GPU's NVLink Firewall blocks other GPUs from directly accessing its video memory.
-
During initialization, the GPU driver and library functions within the CPU TEE establish an encrypted channel with the GPU using the Security Protocol and Data Model (SPDM). After key negotiation, only ciphertext is transmitted over PCIe between the CPU and GPU, ensuring the confidentiality of data in transit.
-
The GPU's remote attestation capability verifies its secure state.
Specifically, applications in a confidential computing instance can use the Attestation software development kit (SDK) to call the GPU driver and obtain a cryptographic security report from the GPU hardware. This report contains cryptographically signed GPU hardware information, VBIOS, and hardware state measurements. A relying party can compare the measurements with the reference measurements provided by the GPU vendor to verify the GPU's secure confidential computing state.
Applicability
Heterogeneous confidential computing supports only Alibaba Cloud Linux 3 images. If you use a custom image built from Alibaba Cloud Linux 3 to create an instance, ensure that its kernel version is not lower than 5.10.134-18.
Create a heterogeneous confidential computing instance (gn8v-tee)
Console
You can create a heterogeneous confidential computing instance on the console much like a regular instance, but you must set specific options. This section describes only the configurations specific to these instances. For all other configurations, see Create an instance by using the wizard.
Go to ECS console - Instances.
In the top navigation bar, select the region and resource group of the resource that you want to manage.
-
Click Create Instance and configure the following settings for the instance.
Parameter
Description
region and zone
China (Beijing) zone L
instance type
Only instance types ecs.gn8v-tee.4xlarge or larger are supported.
image
Select the Alibaba Cloud Linux 3.2104 LTS 64-bit image.
public IP address
Assign Public IPv4 Address. This option is required to download drivers from the NVIDIA website.
ImportantWhen you create a confidential instance with eight GPUs, do not attach additional secondary elastic network interfaces. Doing so may prevent the instance from starting.
-
Follow the on-screen instructions to finish creating the instance.
OpenAPI and CLI
You can call the RunInstances operation or use Alibaba Cloud CLI to create a TDX-enabled ECS instance. The required parameters are described in the following table.
|
Parameter |
Description |
Example |
|
RegionId |
China (Beijing) |
cn-beijing |
|
ZoneId |
zone L |
cn-beijing-l |
|
InstanceType |
Select an instance type of ecs.gn8v-tee.4xlarge or larger. |
ecs.gn8v-tee.4xlarge |
|
ImageId |
Specify the ID of an image that supports heterogeneous confidential computing. Currently, only Alibaba Cloud Linux 3.2104 LTS 64-bit images with a kernel version of 5.10.134-18.al8.x86_64 or later are supported. |
aliyun_3_x64_20G_alibase_20250117.vhd |
CLI example:
In the command,<SECURITY_GROUP_ID>is the ID of the security group,<VSWITCH_ID>is the ID of the VSwitch, and<KEY_PAIR_NAME>is the name of the SSH key pair.
aliyun ecs RunInstances \
--RegionId cn-beijing \
--ZoneId cn-beijing-l \
--SystemDisk.Category cloud_essd \
--ImageId 'aliyun_3_x64_20G_alibase_20250117.vhd' \
--InstanceType 'ecs.gn8v-tee.4xlarge' \
--SecurityGroupId '<SECURITY_GROUP_ID>' \
--VSwitchId '<VSWITCH_ID>' \
--KeyPairName <KEY_PAIR_NAME>
Build a heterogeneous confidential computing environment
Step 1: Install NVIDIA driver and CUDA Toolkit
Heterogeneous confidential instances take longer to initialize. Wait until the instance status is Running and its operating system has fully started before you proceed.
The installation steps vary based on the instance type:
-
Single-GPU confidential instances: ecs.gn8v-tee.4xlarge and ecs.gn8v-tee.6xlarge
-
8-GPU confidential instances: ecs.gn8v-tee-8x.16xlarge and ecs.gn8v-tee-8x.48xlarge
Single-GPU confidential instances
-
Connect to the confidential instance.
For more information, see Log on to a Linux instance using Workbench.
-
Adjust the kernel parameters to set the SWIOTLB buffer to 8 GB.
sudo grubby --update-kernel=ALL --args="swiotlb=4194304,any" -
Restart the instance for the changes to take effect.
For more information, see Restart an instance.
-
Download the NVIDIA driver and CUDA Toolkit.
Single-GPU confidential instances require driver version
550.144.03or later. This topic uses version550.144.03as an example.wget --referer=https://www.nvidia.cn/ https://cn.download.nvidia.cn/tesla/550.144.03/NVIDIA-Linux-x86_64-550.144.03.run wget https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda_12.4.1_550.54.15_linux.run -
Install dependencies and disable the CloudMonitor service.
sudo yum install -y openssl3 sudo systemctl disable cloudmonitor sudo systemctl stop cloudmonitor -
Create and configure
nvidia-persistenced.service.cat > nvidia-persistenced.service << EOF [Unit] Description=NVIDIA Persistence Daemon Wants=syslog.target Before=cloudmonitor.service [Service] Type=forking ExecStart=/usr/bin/nvidia-persistenced --user root ExecStartPost=/usr/bin/nvidia-smi conf-compute -srs 1 ExecStopPost=/bin/rm -rf /var/run/nvidia-persistenced [Install] WantedBy=multi-user.target EOF sudo cp nvidia-persistenced.service /usr/lib/systemd/system/nvidia-persistenced.service -
Install the NVIDIA driver and CUDA Toolkit.
sudo bash NVIDIA-Linux-x86_64-550.144.03.run --ui=none --no-questions --accept-license --disable-nouveau --no-cc-version-check --install-libglvnd --kernel-module-build-directory=kernel-open --rebuild-initramfs sudo bash cuda_12.4.1_550.54.15_linux.run --silent --toolkit -
Start the nvidia-persistenced and CloudMonitor services.
sudo systemctl start nvidia-persistenced.service sudo systemctl enable nvidia-persistenced.service sudo systemctl start cloudmonitor sudo systemctl enable cloudmonitor
8-GPU confidential instances
-
Connect to the confidential instance.
For more information, see Log on to a Linux instance using Workbench.
ImportantConfidential instances take longer to initialize. Wait for the instance to fully start before you proceed.
-
Adjust the kernel parameters to set the SWIOTLB buffer to 8 GB.
sudo grubby --update-kernel=ALL --args="swiotlb=4194304,any" -
Configure the loading behavior of the NVIDIA driver and regenerate the initramfs.
sudo bash -c 'cat > /etc/modprobe.d/nvidia-lkca.conf << EOF install nvidia /sbin/modprobe ecdsa_generic; /sbin/modprobe ecdh; /sbin/modprobe --ignore-install nvidia options nvidia NVreg_RegistryDwords="RmEnableProtectedPcie=0x1" EOF' sudo dracut --regenerate-all -f -
Restart the instance for the changes to take effect.
For more information, see Restart an instance.
-
Download the NVIDIA driver, CUDA Toolkit, and Fabric Manager.
8-GPU confidential instances require driver version
570.148.08or later and the corresponding version ofFabric Manager. This topic uses version570.148.08as an example.wget --referer=https://www.nvidia.cn/ https://cn.download.nvidia.cn/tesla/570.148.08/NVIDIA-Linux-x86_64-570.148.08.run wget https://developer.download.nvidia.com/compute/cuda/12.8.1/local_installers/cuda_12.8.1_570.124.06_linux.run wget https://developer.download.nvidia.cn/compute/cuda/repos/rhel8/x86_64/nvidia-fabric-manager-570.148.08-1.x86_64.rpm -
Install dependencies and disable the CloudMonitor service.
sudo yum install -y openssl3 sudo systemctl disable cloudmonitor sudo systemctl stop cloudmonitor -
Create and configure
nvidia-persistenced.service.cat > nvidia-persistenced.service << EOF [Unit] Description=NVIDIA Persistence Daemon Wants=syslog.target Before=cloudmonitor.service After=nvidia-fabricmanager.service [Service] Type=forking ExecStart=/usr/bin/nvidia-persistenced --user root --uvm-persistence-mode --verbose ExecStartPost=/usr/bin/nvidia-smi conf-compute -srs 1 ExecStopPost=/bin/rm -rf /var/run/nvidia-persistenced TimeoutStartSec=900 TimeoutStopSec=60 [Install] WantedBy=multi-user.target EOF sudo cp nvidia-persistenced.service /usr/lib/systemd/system/nvidia-persistenced.service -
Install Fabric Manager, the NVIDIA driver, and the CUDA Toolkit.
sudo rpm -ivh nvidia-fabric-manager-570.148.08-1.x86_64.rpm sudo bash NVIDIA-Linux-x86_64-570.148.08.run --ui=none --no-questions --accept-license --disable-nouveau --no-cc-version-check --install-libglvnd --kernel-module-build-directory=kernel-open --rebuild-initramfs sudo bash cuda_12.8.1_570.124.06_linux.run --silent --toolkit -
Start and enable the nvidia-fabricmanager, nvidia-persistenced, and CloudMonitor services.
sudo systemctl start nvidia-fabricmanager.service sudo systemctl enable nvidia-fabricmanager.service sudo systemctl start nvidia-persistenced.service sudo systemctl enable nvidia-persistenced.service sudo systemctl start cloudmonitor sudo systemctl enable cloudmonitor
Step 2: Check the TDX status
The heterogeneous confidential computing feature is built on TDX. First, check the TDX status of your instance to ensure it is protected.
-
Check whether TDX is enabled.
lscpu |grep -i tdx_guestThe following command output indicates that TDX is enabled.
-
Check that the TDX-related drivers are installed.
ls -l /dev/tdx_guestThe following output indicates that the TDX-related drivers are installed.

Step 3: Check GPU confidential computing status
Single-GPU confidential instances
Run the following command to check the confidential computing feature status.
nvidia-smi conf-compute -f
An output of CC status: ON indicates that the confidential computing feature is enabled. If the command returns CC status: OFF, the feature is disabled due to an instance error. In this case, submit a ticket

8-GPU confidential instances
Run the following command to check the confidential computing feature status.
nvidia-smi conf-compute -mgm
An output of Multi-GPU Mode: Protected PCIe indicates that the multi-GPU confidential computing feature is enabled. If the command returns Multi-GPU Mode: None, the feature is disabled due to an instance error. In this case, submit a ticket

For 8-GPU confidential instances, the nvidia-smi conf-compute -f command normally returns CC status: OFF.
Step 4: Verify GPU and NVSwitch trust
Single-GPU confidential instances
-
Install the dependencies for GPU trust.
sudo yum install -y python3.11 python3.11-devel python3.11-pip sudo alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 60 sudo alternatives --set python3 /usr/bin/python3.11 sudo python3 -m ensurepip --upgrade sudo python3 -m pip install --upgrade pip sudo python3 -m pip install nv_attestation_sdk==2.5.0.post6914366 nv_local_gpu_verifier==2.5.0.post6914366 nv_ppcie_verifier==1.5.0.post6914366 -f https://attest-public-cn-beijing.oss-cn-beijing.aliyuncs.com/repo/pip/attest.html -
Run the following command to verify the GPU trust status.
python3 -m verifier.cc_admin --user_modeThe output indicates that the GPU is in confidential computing mode and that measurements for components such as the driver and VBIOS match their expected values:

8-GPU confidential instances
-
Install the dependencies for GPU trust.
sudo yum install -y python3.11 python3.11-devel python3.11-pip sudo alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 60 sudo alternatives --set python3 /usr/bin/python3.11 sudo python3 -m ensurepip --upgrade sudo python3 -m pip install --upgrade pip sudo python3 -m pip install nv_attestation_sdk==2.5.0.post6914366 nv_local_gpu_verifier==2.5.0.post6914366 nv_ppcie_verifier==1.5.0.post6914366 -f https://attest-public-cn-beijing.oss-cn-beijing.aliyuncs.com/repo/pip/attest.html -
Install dependencies for NVSwitch.
wget https://developer.download.nvidia.cn/compute/cuda/repos/rhel8/x86_64/libnvidia-nscq-570-570.148.08-1.x86_64.rpm sudo rpm -ivh libnvidia-nscq-570-570.148.08-1.x86_64.rpm -
Run the following command to verify the trust status of the GPUs and NVSwitches.
python3 -m ppcie.verifier.verification --gpu-attestation-mode=LOCAL --switch-attestation-mode=LOCALThe command verifies eight GPUs and four NVSwitches. An output of SUCCESS indicates a successful verification:

Known limitations
-
Since the heterogeneous confidential computing feature is built on TDX, heterogeneous confidential computing instances inherit the limitations of TDX confidential computing instances. For more information, see Known limitations of TDX instances.
-
When the GPU confidential computing feature is enabled, data transfer between the CPU and GPU requires encryption and decryption. This overhead degrades GPU performance compared to a non-confidential heterogeneous instance.
Heterogeneous confidential computing notes
-
Single-GPU instances use CUDA 12.4. The NVIDIA cuBLAS library has a known issue that may cause errors when you run CUDA or large language model tasks. To resolve this, install a specific version of the cuBLAS library.
pip3 install nvidia-cublas-cu12==12.4.5.8 -
When the GPU confidential computing feature is enabled, the initialization process is slow, especially for 8-GPU confidential instances. After the guest OS starts, verify that the nvidia-persistenced service has started before you use the GPU by running nvidia-smi or other commands. To check the status of the nvidia-persistenced service, run the following command:
systemctl status nvidia-persistenced | grep "Active: "-
activating (start)means the service is starting.Active: activating (start) since Wed 2025-02-19 10:07:54 CST; 2min 20s ago -
active (running) means the service is running.
Active: active (running) since Wed 2025-02-19 10:10:28 CST; 22s ago
-
-
Configure any auto-start service that uses the GPU, such as cloudmonitor.service, nvidia-cdi-refresh.service (from the nvidia-container-toolkit-base package), or ollama.service, to start after nvidia-persistenced.service.
The following is an example configuration for
/usr/lib/systemd/system/nvidia-persistenced.service:[Unit] Description=NVIDIA Persistence Daemon Wants=syslog.target Before=cloudmonitor.service nvidia-cdi-refresh.service ollama.service After=nvidia-fabricmanager.service [Service] Type=forking ExecStart=/usr/bin/nvidia-persistenced --user root --uvm-persistence-mode --verbose ExecStartPost=/usr/bin/nvidia-smi conf-compute -srs 1 ExecStopPost=/bin/rm -rf /var/run/nvidia-persistenced TimeoutStartSec=900 TimeoutStopSec=60 [Install] WantedBy=multi-user.target

