In real-world scenarios, trusted execution environments (TEEs) frequently host applications that lack the trust of the infrastructure provider, as well as data owners who have specifically outsourced their data for remote processing. We present Twine, a trusted runtime for running WebAssembly-compiled applications within TEEs, establishing a two-way sandbox. Twine leverages memory safety guarantees of WebAssembly (Wasm) and abstracts the complexity of TEEs, empowering the execution of legacy and language-agnostic applications. It extends the standard WebAssembly system interface (WASI), providing controlled OS services, focusing on I/O. Additionally, through built-in TEE mechanisms, Twine delivers attestation capabilities to ensure the integrity of the runtime and the OS services supplied to the application. We evaluate its performance using general-purpose benchmarks and real-world applications, showing it compares on par with state-of-the-art solutions. A case study involving fintech company Credora reveals that Twine can be deployed in production with reasonable performance trade-offs, ranging from a 0.7x slowdown to a 1.17x speedup compared to native run time. Finally, we identify performance improvement through library optimisation, showcasing one such adjustment that leads up to 4.1x speedup. Twine is open-source and has been upstreamed into the original Wasm runtime, WAMR.
翻译:在真实场景中,可信执行环境(TEE)常承载着基础设施提供者不信任的应用程序,以及专门将数据外包以进行远程处理的数据所有者。我们提出Twine——一种在TEE内部运行WebAssembly编译应用程序的可信运行时,建立双向沙箱。Twine利用WebAssembly(Wasm)的内存安全保证,并抽象TEE的复杂性,赋能遗留应用及语言无关应用的执行。它扩展了标准WebAssembly系统接口(WASI),提供受控的操作系统服务,重点关注I/O。此外,通过内置的TEE机制,Twine提供远程证明能力,确保运行时及提供给应用的操作系统服务的完整性。我们使用通用基准测试和真实应用评估其性能,结果表明其与现有最佳方案性能相当。金融科技公司Credora的案例研究表明,Twine可在生产环境部署且性能折衷合理——相较于原生运行时,其运行时间介于0.7倍减速至1.17倍加速之间。最后,我们通过库优化识别性能提升点,展示了一种可使性能提升至4.1倍的调优方案。Twine已开源并合入上游Wasm运行时WAMR。