Dhanraj, VijayChawla, HarpreetManila, DanielSchneider, EricFu, EricaPorter, DonaldTsai, Chia-CheVij, Mona2025-10-012025-10-012025-09-08https://hdl.handle.net/10919/137877The second version of Intel® Software Guard Extensions (Intel SGX), or SGX2, adds dynamic management of enclave memory and threads. The first version required the address space and thread counts to be fixed before execution. The Enclave Dynamic Memory Management (EDMM) feature of SGX2 has the potential to lower launch times and overall execution time. Despite reducing the enclave loading time by 28–93%, straightforward EDMM adoption strategies actually slow execution time down by as much as 58%. Using the Gramine library OS as a representative enclave runtime environment, this paper shows how to recover EDMM performance. The paper explains how implementing mutual distrust between the OS and enclave increases the cost of modifying page mappings. The paper then describes a series of optimizations and, using application benchmarks, shows that these optimizations effectively eliminate the overheads of EDMM while retaining EDMM’s performance and flexibility gains.application/pdfenIn CopyrightAdaptive and Efficient Dynamic Memory Management for Hardware EnclavesArticle - Refereed2025-10-01The author(s)https://doi.org/10.1145/3757347.3759137