Abstract
Hardware support for trusted execution in modern CPUs enables tenants to shield their data processing workloads in otherwise untrusted cloud environments. Runtime systems for the trusted execution must rely on an interface to the untrusted host OS to use external resources such as storage, network, and other functions. Attackers may exploit this interface to leak data or corrupt the computation. We describe SGX-LKL, a system for running Linux binaries inside of Intel SGX enclaves that only exposes a minimal, protected and oblivious host interface: the interface is (i) minimal because SGX-LKL uses a complete library OS inside the enclave, including file system and network stacks, which requires a host interface with only 7 calls; (ii) protected because SGX-LKL transparently encrypts and integrity-protects all data passed via low-level I/O operations; and (iii) oblivious because SGX-LKL performs host operations independently of the application workload. For oblivious disk I/O, SGX-LKL uses an encrypted ext4 file system with shuffled disk blocks. We show that SGX-LKL protects TensorFlow training with a 21% overhead.
Introduction: The Vulnerability of the Host Interface
Hardware-based Trusted Execution Environments (TEEs), such as Intel SGX, provide secure enclaves to protect sensitive code and data from a potentially compromised host Operating System. However, these enclaves are not entirely self-sufficient; they must interact with the host OS to access essential resources like persistent storage and network connectivity. This interaction occurs through a "host interface," which has historically been a significant security bottleneck.
Existing TEE runtime systems often prioritize application compatibility by forwarding hundreds of system calls directly to the host. This approach introduces three critical risks: data leakage through sensitive system call parameters, integrity violations (such as "Iago attacks" where a malicious host manipulates return values to hijack control flow), and side-channel leaks. Even when data is encrypted, the specific patterns of disk or network access can reveal sensitive information about the application's internal state.
As shown in the security breakdown above, systems like Panoply and Graphene-SGX expose a vast attack surface. In contrast, SGX-LKL reduces this interface to a mere seven low-level calls, significantly hardening the enclave boundary.
The SGX-LKL Architecture
The fundamental innovation of SGX-LKL is moving the complexity of the operating system inside the enclave. Rather than relying on the host OS to manage high-level logic like file systems or network stacks, SGX-LKL incorporates the Linux Kernel Library (LKL)—a port of the Linux kernel to userspace—directly into the trusted environment.
By running a full library OS inside the enclave, SGX-LKL can handle POSIX system calls internally. This architecture allows the system to communicate with the host using only low-level primitives for disk and network I/O, signals, and time. This design not only improves security but can also enhance performance by avoiding expensive "enclave exits" for every system call.
Design Pillars: Minimality, Protection, and Obliviousness
SGX-LKL secures the host interface through three core principles:
- Minimality: The interface is stripped down to just seven calls (e.g.,
disk_read,net_poll,time_read). This drastically reduces the number of entry points an attacker can exploit. - Protection: All data crossing the enclave boundary is transparently encrypted and integrity-protected. SGX-LKL utilizes standard Linux tools like
dm-cryptanddm-integrityfor storage, while network traffic is secured via aWireguardVPN overlay. - Obliviousness: To prevent side-channel analysis, SGX-LKL ensures that host operations are independent of the actual application workload. Network calls are executed in fixed-interval batches, with "dummy" calls inserted during idle periods. For storage, the system employs a "k-oblivious shuffle" to randomize the physical location of disk blocks, ensuring the host sees only random access patterns regardless of the application's logic.
Evaluation and Results
The researchers evaluated SGX-LKL using data-intensive workloads, including the PARSEC benchmark suite and TensorFlow training on ImageNet and CIFAR-10 datasets.
Key findings include:
- Security vs. Performance: Implementing the full suite of "oblivious" features—the most rigorous security setting—results in a manageable 21% overhead for TensorFlow training.
- Efficiency Gains: In "software mode" (ignoring hardware memory limits), SGX-LKL can actually outperform native Linux by up to 33% for certain models, as internal system call handling is more efficient than standard kernel transitions.
- Hardware Bottlenecks: On current SGX v1 hardware, performance is primarily limited by the 128MB Enclave Page Cache (EPC). Memory-heavy applications may experience slowdowns due to paging, a limitation expected to diminish with newer hardware generations.
Conclusion
SGX-LKL demonstrates that it is possible to run unmodified Linux binaries in a TEE while maintaining a minimal and secure host interface. While including a full library OS increases the internal Trusted Computing Base (TCB), the resulting reduction in the external attack surface and the addition of obliviousness provide a more robust defense against sophisticated host-level attackers. Future work will focus on automating the tuning of obliviousness parameters and adapting to larger enclave memory capacities.
Summary updated