Description
Dynamic linking is an important feature for many applications, making it an integral function to provide in Trusted Execution Environments (TEEs) to improve the ease of use and encourage adoption of TEEs for security and privacy. However, the implementation of dynamic linking in enclaves poses many challenges, for example, the proper verification of code loaded after an enclave has begun execution and the efficient initialization of enclaves. Previous TEEs have included dynamic linking functionality but either fail to accommodate library sharing or require that libraries be manually loaded in advance. Our work draws upon previous studies to provide two methods of dynamic loading that allow for customization to users’ needs. First, we provide trusted loading after enclave execution as the default loading method that can automatically load in shared libraries by coordinating with an untrusted OS. Second, we provide library enclaves as an optimization for commonly used libraries to be pre-loaded and verified prior to enclave execution. These library enclaves allow for sharing between multiple enclave applications. While previous work has been done on proprietary software, we implement our design in Keystone, an open-source RISC-V framework for constructing customizable TEEs, making our work accessible for future research and study. Finally, we expand on previous dynamic library implementations by accounting for mitigations against side-channels attacks. We propose a cache tagging solution to defend against the Flush+Reload side-channel attack and analyze its performance tradeoffs through simulation.