Abstract
This research evaluates the feasibility of using Intel SGX enclaves to secure storage data paths without compromising system performance. While SGX can achieve near-native encryption speeds (90–99% of non-enclave performance), the study reveals that reaching this level requires meticulous tuning of buffer sizes, library choices, and memory access patterns. We identify critical "performance cliffs" related to cache and enclave memory limits that developers must navigate to build efficient secure storage systems.
Introduction
In modern storage environments, data-at-rest encryption is a standard requirement. However, software-based encryption often leaves sensitive keys "in the clear" within system memory, creating a vulnerability to privileged users or memory-sniffing attacks. While hardware solutions like Self-Encrypting Drives (SEDs) exist, they cannot facilitate complex end-to-end security scenarios, such as terminating a TLS connection and re-encrypting data for disk within a single secure boundary.
Intel SGX (Software Guard Extensions) offers a potential solution by providing hardware-enforced "enclaves"—isolated execution environments. The primary challenge lies in SGX's known sensitivity to overhead from context switching (ECALLs) and memory encryption. This paper investigates whether SGX is viable for high-throughput storage workloads and identifies the hidden performance traps for developers.
Methodology and Architecture
The researchers designed micro-benchmarks to isolate various overheads across two primary security configurations:
- Protecting Keys Only: The encryption process and keys reside within the enclave, but data buffers remain in untrusted general memory (utilizing the
user_checkattribute). - End-to-End Protection: Both keys and data reside within the enclave's encrypted memory (Enclave Page Cache, or EPC), ensuring data is never decrypted in general memory.
Tests were conducted using synthetic micro-benchmarks involving generated byte arrays to simulate storage blocks. The evaluation compared the standard sgxsdk crypto library, the optimized sgxssl (leveraging AES-NI hardware acceleration), and native openssl across varying workloads and thread counts.
Performance Insights: Navigating the "Cliffs"
A central finding of the study is that SGX performance is not linear; it is characterized by several "performance cliffs" dictated by hardware architecture:
- The ECALL Tax: For small data blocks (under 64KB), the overhead of entering the enclave (an ECALL) dominates the execution time. High throughput requires batching operations or using larger block sizes.
- L3 Cache and MEE Latency: When data resides inside the enclave, performance drops significantly once the buffer size exceeds the L3 cache (8MB in the test environment). The SGX Memory Encryption Engine (MEE) adds latency that is normally masked by the cache but becomes apparent during cache misses.
- The EPC Limit: Once data exceeds the Enclave Page Cache (EPC) size (roughly 96MB), performance craters due to the paging mechanism required to swap encrypted pages in and out of regular memory.
Key Results
- Efficiency of Key Protection: For large messages, the "Protecting Keys Only" approach achieved 96% of the throughput of unencrypted native code, reaching approximately 5GB/sec.
- End-to-End Security Costs: When data was kept entirely within the enclave, throughput reached approximately 70% of native speed for large buffers, limited primarily by L3 cache misses.
- Library Optimization: The choice of library is critical; the default
sgxsdkperformed at only 43% of native speed, whereassgxsslreached near-native speeds by leveraging hardware-specific optimizations. - Scaling: Performance scaled linearly with physical cores, though contention for the L3 cache caused drops in multi-threaded performance for buffers larger than 1MB.
Conclusion and Future Work
SGX is a viable tool for securing storage data paths, but it is not a "plug-and-play" solution. Achieving acceptable performance requires deep knowledge of hardware limits, specifically regarding cache sizes and EPC boundaries. Future work should explore "switchless" ECALLs to reduce overhead for small-block workloads and evaluate performance on newer CPU architectures with expanded EPC capacities.
Summary updated