Every layer of your deployment, measured.
How each attestation value is computed, and the values Phala Cloud publishes for checking it. To check a running CVM against them, open Verify Attestation from the CVM’s page in the console.
Each time a CVM boots, the CPU signs a quote. It carries five measurements, MRTD and RTMR0 to RTMR3, and one field the launcher sets, MR_CONFIG_ID. Each covers a different part of the machine.
RTMR0 to RTMR3 are running hashes. Each starts as zeros, and every step replaces it:
new value = SHA-384(old value ‖ measurement)
So the order matters, and nothing can be undone. MRTD is computed once, over the firmware as it is loaded. The example machine follows dstack 0.6 and replays every value. Below, click any label to see what it is and the values Phala Cloud publishes for it.
Four layers. Each feeds different values, and keeps its color across this page.
Measured by the CPU, before the machine starts
A hash of the boot firmware and nothing else. It cannot change after the machine starts.
Measuring the example…
MRTD
Changes when: New firmware in an OS image, or a host QEMU upgrade. Most image upgrades keep the same firmware.
Extended by the firmware, early in boot
The machine’s shape. Two machines of the same instance type get the same RTMR0 when the firmware, the QEMU version and the host’s settings are the same.
Measuring the example…
RTMR0
Changes when: A different instance type, a host QEMU upgrade or different host settings, new firmware in an OS image, or a change to the app compose’s verity volumes.
Extended by the firmware, as it starts the kernel
Starts with a hash of the kernel file. The rest are fixed markers, so only a kernel change moves it.
Measuring the example…
RTMR1
Changes when: An OS image upgrade that rebuilds the kernel.
Extended by the firmware, as it starts the kernel
The kernel command line and the initrd. The command line carries the root filesystem’s hash, so a root filesystem change lands here too.
Measuring the example…
RTMR2
Changes when: Every OS image upgrade.
Extended by the guest OS, once per boot event
The only value the guest OS writes: one event at a time, in this order. The event log ships with the attestation report, so anyone can replay it.
Measuring the example…
RTMR3
Changes when: Any change to the app compose, the OS image, the KMS or the instance. On a GPU machine it also changes on every boot.
Written by the launcher, before the machine starts
Binds the app before it boots. The launcher writes a short document that names the app, and MR_CONFIG_ID is its hash. RTMR3 then records what the guest actually loaded, and the guest stops booting if the two disagree.
Measuring the example…
MR_CONFIG_ID
Changes when: Any change to the app compose, the pinned KMS or the instance, and moving to or from a GPU. Not an OS image upgrade within dstack 0.6. An app compose that does not pin a key provider ID gets the older form: a version byte and the compose hash itself. A host that does not set MR_CONFIG_ID leaves it all zeros.
Read from the quote, not measured
The six values describe the CVM. The quote also says which physical machine it runs on, and whether that machine’s firmware is current. A KMS checks both before it releases keys.
Checked by the KMS
Changes when: The CVM moves to another machine, or the vendor publishes new firmware and the machine’s status drops until it is updated.
Run it on the example. The values that moved are marked.
Pick an operation to see which values it changes.
Change an input to see which values move.
RTMR1 and RTMR2 from the new image with dstack-mr.os-image-hash event to get RTMR3.MRTD and RTMR0 to RTMR2: compute them from the image with the open-source dstack-mr tool, for your vCPU count and memory size, and compare. The host’s QEMU version and settings feed these values too. A GPU machine needs more flags, such as --num-gpus, --hugepages and --pci-hole64-size; see dstack-mr measure --help.
dstack-mr measure <image>/metadata.json --cpu <N> --memory <M>
RTMR3: replay the event log from the attestation report with the formula above, as the example does. The example uses the default event log format; an app compose can opt into version 2, which hashes a JSON form of each event. Also check the quote’s signature, the platform’s TCB status, and that debug mode is off.