ASAravind Sivakumaran
Theme

Theme and appearance

Appearance
Palette

Pick any colour. The displayed accent adjusts for readable contrast in light or dark mode.

← IOMMU star map

SECURITY / CONFIDENTIAL VMs

Who can touch a confidential VM's memory?

In an ordinary VM the host can read and change every byte of the guest. A confidential VM (AMD calls its design SEV-SNP) keeps the host out: its pages are encrypted with the VM's own key, and a table the host can change only through instructions such as RMPUPDATE, never by writing it, the Reverse Map Table (RMP), records who owns every page of RAM. A guest address (GPA) still becomes a real one (SPA) through a table the host owns (the CPU's nested page table; the IOMMU has its own, the stage 2 of the virtual IOMMU page), but the host is no longer trusted: the RMP is checked after it. Write a secret, then let the host try its luck.

Which experiment answers my question?
Each link opens the chapter's experiments; pick the named one from the menu
QuestionStart with
Does changing the address move the bytes?Receive: watch the whole timeline
Can sharing expose more than my message?Share a page, share everything on it
Can private input still be rejected, or change after I checked it?Received is not trusted, then An approval can expire
Does a valid mapping authorize a private page?Same GPA, different guests, The right owner, the wrong page, A shared page yes, a private page no
Is a device in RUN trusted with my data?RUN is not permission, A device has a privilege level too
Does repairing a mapping finish recovery?A fence outlives the repair
Does a valid signature authorize releasing a secret?Release a secret only to the attested session
Does encryption catch tampering and replay?Protect the record, not just the memory
Does an error undo what already happened?A failed mapping already copied the secret, Half a transfer is still half done
What claims does this page make? 3 points
A guest access goes from the guest's CPU through the host's nested table to an SPA, then the RMP check, then RAM. A host access goes straight to the RMP check (writes) or to RAM (reads). Host hypervisor, by SPA Guest CPU by GPA, C-bit, VMPL Nested table host's: GPA → SPA RMP check owner, GPA, valid, VMPL RAM page encrypted Dashed: host reads skip the RMP check; they see ciphertext.

Experiments

Words used in the experiments
Host, hypervisor
The software that runs the VM. Here it is not trusted with the VM's data.
GPA, SPA
Guest-physical address (the VM's idea of RAM) and system-physical address (RAM in the usual case, a peer device's memory on a peer-to-peer path). The host's nested table maps one to the other.
ASID
The number that names a guest and selects its memory-encryption key. A is ASID 1, B is ASID 2.
RMP
Reverse Map Table: one entry per 4 KiB page of RAM saying who owns it, at which GPA, and whether the guest has validated it.
C-bit
A bit in the guest's own page table: 1 for a private (encrypted) access, 0 for a shared one.
RMPUPDATE, PVALIDATE, RMPADJUST
Instructions: the host assigns a page; the guest accepts it; a guest privilege level passes page permissions down.
VMPL, SVSM
Privilege levels inside one VM, 0 (most) to 3. A Secure VM Service Module often runs at VMPL0 and the guest kernel below it.
#PF, #NPF, #VC
A page fault (the host's, in the examples here, though one can also arise in guest execution), a nested page fault the host handles for the guest, and the guest's own VMM Communication exception.
VMSA, GHCB
The VM's saved registers (protected), and a page the guest shares to pass chosen values to the host.

Experiment

The latest access: which address, which record

Bytes at offsets 0x120 to 0x13f of A's page, as A reads them

      Intel and Arm:

      The RMP, scene by scene

      Each scene runs the same teaching model as the experiments above, on ordinary 4 KiB private pages with synthetic addresses. Every table is the model's own record after your last action. Not modelled: large pages, special pages, migration, and a real RMP entry layout.

      What each side holds after that step

      The latest guest access, check by check

        RMP · changed only by instructions; pages not listed are HYPERVISOR

          Nested tables · the host edits them

            RAM as the host reads it

              What software read

                Faults

                  The model keeps 16 or 32 bytes per page. Its "ciphertext" is a stand-in that changes with the key and the address, not AES, and its RMP lines are the white paper's fields, not AMD's packed entry. Not modelled: 2 MiB RMP entries, the Immutable states other than FIRMWARE, SNP guest messages and interrupts, execute checks, and when permissions are first set: the 2020 white paper has the guest's first PVALIDATE give VMPL0 full access and the others none, as modelled here, but a newer APM revision (24593 rev 3.44, §15.36.7) is reported to set initial permissions when the page is assigned, so treat the exact instruction an experiment credits as the white paper's, not the current manual's. Devices come next: can a device reach private memory?

                  A page's life: the RMP states

                  The RMP is "a single data structure shared across the system that contains one entry for every 4k page of DRAM that may be used by VMs". Each entry puts its page in one of eight states. Instructions move a page between the first three; the AMD Secure Processor (AMD-SP, also called the ASP or PSP) owns the immutable ones.

                  HYPERVISOR to GUEST-INVALID by RMPUPDATE, GUEST-INVALID to GUEST-VALID by PVALIDATE, and back; the immutable states belong to the AMD-SP. HYPERVISORshared, host-owned GUEST-INVALIDassigned, not accepted GUEST-VALIDprivate, usable RMPUPDATE PVALIDATE PVALIDATE (rescind) RMPUPDATE (to host) PRE-GUEST, PRE-SWAP, FIRMWARE, METADATA, CONTEXT: immutable, changed only by the AMD-SP.
                  StateWhat it means (white paper, Table 3)
                  HYPERVISORDefault for unassigned memory: the host's own, non-SNP VMs' and shared (C=0) memory.
                  GUEST-INVALIDAssigned to a guest, not yet usable: the guest has not validated it.
                  GUEST-VALIDAssigned and usable as the guest's private (C=1) memory.
                  PRE-GUEST, PRE-SWAPImmutable; PRE-GUEST not validated, PRE-SWAP validated.
                  FIRMWARE, METADATA, CONTEXTImmutable pages the AMD-SP uses for itself, for swap metadata and for per-VM data.

                  One read, all the way

                  Guest A reads GVA 0x4000_0120 (the study notes' E09):

                  1. Guest page table (the guest's): GVA → GPA 0x0020_0120.
                  2. Nested table (the host's): GPA → SPA 0x8000_0120; the offset 0x120 survives both.
                  3. RMP entry for SPA page 0x8000_0000: owner A, GPA page 0x0020_0000, validated, 4 KiB, VMPL0 may read. Every check passes.
                  4. RAM: the memory controller decrypts with A's key. A sees its plaintext.

                  The RMP is not another translation step: it does not change the address, it decides whether the one the tables produced may be used. Two guest virtual addresses that reach the same GPA are fine (E11); two GPAs that try to use the same private page are not, because the RMP entry names exactly one GPA.

                  Which fault is which

                  You seeWho gets itHere it means
                  #PF (RMP)the hostThe host wrote a page the RMP gives to a guest or the AMD-SP.
                  #NPF, RMP bit (31)the host, for the guestThe page's owner or GPA does not match the access, or the C-bit does not match the page's state. Linux names the bits PFERR_GUEST_RMP_MASK and, for a C=1 access, PFERR_GUEST_ENC_MASK (34).
                  #NPF, VMPL bit (36)the host, for the guestThis VMPL lacks the permission (PFERR_GUEST_VMPL_MASK).
                  #VCthe guestThe page is assigned but not validated. Also raised for instructions the host would intercept (CPUID, MSR and I/O accesses); the #VC handler then asks the host through the GHCB. So it is not an error in general.
                  RMP_PAGE_FAULTthe IOMMU's event logA device's access failed the RMP check: see secure DMA.
                  A rejected lengthguest softwareA protocol check (E08, E16). Not a hardware fault at all.

                  SME, SEV, SEV-ES and SNP: what each adds

                  NameProtectsDoes not by itself give
                  SME, TSMEWhat DRAM holds: memory encrypted with a host key (TSME without the OS choosing pages).Any protection from the host's own software.
                  SEVA VM's memory, with its own key.Protection from a host that remaps or rewrites pages.
                  SEV-ESThe VM's saved registers (VMSA) across exits.Integrity of the rest of RAM.
                  SEV-SNPIntegrity too: the RMP, validation, VMPLs, attestation.Trust in devices: see trusted I/O.

                  Two names often merged: a memory-encryption key (SME-MK on AMD, MKTME on Intel) chooses how memory is encrypted, while a protection key (MPK, PKU) only switches access rights; it encrypts nothing (E05). And two host keys do not make two confidential VMs: ownership, validation and evidence are separate records (E04).

                  Intel TDX and Arm CCA

                  The same questions, other designs. This guide describes them only as far as the sources below say; it has no model of either.

                  AMD SEV-SNPIntel TDXArm CCA
                  Protected VMSNP guestTrust domain (TD)Realm
                  Trusted managerAMD-SP firmwareThe TDX module, "a CPU-attested software module"The Realm Management Monitor (RMM)
                  Private or sharedC-bit and RMP state"a bit in its page table entries"Protected lower half of the IPA space, shared upper half
                  Accepting memoryPVALIDATEPrivate pages must be accepted before use; premature access causes a #VE or a TD exit according to configuration (Linux normally disables these private-memory #VEs)RIPAS RAM or EMPTY, requested through RSI
                  Host touches private memory#PF on a write; reads see ciphertextThe host cannot access it"cannot be seen by the Normal World"
                  Device DMA todayShared bounce buffers (SWIOTLB)"TDX uses SWIOTLB for most DMA allocations"Bounce buffers in the shared half

                  Sources