Use Models

In this section, we explore two different models that demonstrate how software can utilize the SME (Secure Memory Encryption) feature.

Full Memory Encryption

Full memory encryption is a straightforward and compelling approach for many computing systems, particularly in situations where physical attacks on the system are a concern, such as government data centers or smaller/remote enterprise data centers with limited physical security. With full memory encryption, all contents in DRAM are encrypted using a random key, providing robust protection against cold boot attacks, DRAM interface snooping, and similar threats. This approach also safeguards systems with NVDIMM (Non-Volatile Dual In-line Memory Module), preventing attackers from extracting data by removing a memory module.

To enable full memory encryption with SME, the operating system (OS) or hypervisor (HV) sets the C-bit (Confidentiality-bit) in all DRAM physical addresses within the page tables. This includes both instruction and data pages, as well as the pages corresponding to the page tables themselves. Effectively, the OS or HV software treats the system as having DRAM starting at address 0x8000_0000_0000. If the HV sets the C-bit to encrypt all physical memory, all virtual machines (VMs) controlled by the HV are encrypted using the same encryption key.

Importantly, DMA (Direct Memory Access) to memory encrypted via SME is supported. From the perspective of a device, an encrypted memory access appears as a normal memory access with bit 47 set.

Partial Memory Encryption

The utilization of the C-bit in the page tables offers flexibility for the OS or HV to selectively encrypt only a subset of memory, if desired. This approach still provides physical protection of the encrypted memory, while potentially improving performance for non-sensitive data. Additionally, the choice between encrypted and unencrypted memory can be used to create isolation for critical workloads. One example of this isolation is a system that marks only the memory used by guest VMs as encrypted. This can be achieved without modifying the guest VMs themselves. By setting the C-bit in all the nested page table entries corresponding to DRAM for those VMs (as depicted in figure above), the hypervisor enables encryption for the VM memory exclusively.

This configuration can be employed to protect VMs from a rogue machine administrator. Even if the administrator has access to the hardware and host system, they would not be able to inspect guest VM data, even with memory scanning utilities.

Last updated