Intel SGX
Intel’s Software Guard Extensions (SGX) is a set of extensions to the Intel architecture that aims to provide integrity and confidentiality guarantees to security-sensitive computation performed on a computer where all the privileged software (kernel, hypervisor, etc) is potentially malicious.
SGX Physical Memory Organization
The enclaves’ code and data is stored in Processor Reserved Memory (PRM), which is a subset of DRAM that cannot be directly accessed by other software, including system software and SMM code. The CPU’s integrated memory controllers also reject DMA transfers targeting the PRM, thus protecting it from access by other peripherals.
PRM range registers (PRMRR)
The Enclave Page Cache (EPC)
The contents of enclaves and the associated data struc- tures are stored in the Enclave Page Cache (EPC), which is a subset of the PRM.
The EPC is managed by the same system software that manages the rest of the computer’s physical memory.
Non-enclave software cannot directly access the EPC, as it is contained in the PRM. This restriction plays a key role in SGX’s enclave isolation guarantees, but creates an obstacle when the system software needs to load the initial code and data into a newly created enclave. The SGX design solves this problem by having the instructions that allocate an EPC page to an enclave also initialize the page. Most EPC pages are initialized by copying data from a non-PRM memory page.
The Enclave Page Cache Map (EPCM)
SGX processors check the correctness of the system software’s allocation decisi