Isolation without taxation: near-zero-cost transitions for WebAssembly and SFI
Open Access
- 12 January 2022
- journal article
- research article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Programming Languages
- Vol. 6 (POPL) , 1-30
Abstract
Software sandboxing or software-based fault isolation (SFI) is a lightweight approach to building secure systems out of untrusted components. Mozilla, for example, uses SFI to harden the Firefox browser by sandboxing third-party libraries, and companies like Fastly and Cloudflare use SFI to safely co-locate untrusted tenants on their edge clouds. While there have been significant efforts to optimize and verify SFI enforcement, context switching in SFI systems remains largely unexplored: almost all SFI systems use heavyweight transitions that are not only error-prone but incur significant performance overhead from saving, clearing, and restoring registers when context switching. We identify a set of zero-cost conditions that characterize when sandboxed code has sufficient structured to guarantee security via lightweight zero-cost transitions (simple function calls). We modify the Lucet Wasm compiler and its runtime to use zero-cost transitions, eliminating the undue performance tax on systems that rely on Lucet for sandboxing (e.g., we speed up image and font rendering in Firefox by up to 29.7% and 10% respectively). To remove the Lucet compiler and its correct implementation of the Wasm specification from the trusted computing base, we (1) develop a static binary verifier , VeriZero, which (in seconds) checks that binaries produced by Lucet satisfy our zero-cost conditions, and (2) prove the soundness of VeriZero by developing a logical relation that captures when a compiled Wasm function is semantically well-behaved with respect to our zero-cost conditions. Finally, we show that our model is useful beyond Wasm by describing a new, purpose-built SFI system, SegmentZero32, that uses x86 segmentation and LLVM with mostly off-the-shelf passes to enforce our zero-cost conditions; our prototype performs on-par with the state-of-the-art Native Client SFI system.Keywords
All Related Versions
Funding Information
- EPSRC (EP/K008528/1)
- NSF (CNS-1514435, CNS-2120642, CCF- 1918573, CAREER CNS-2048262)
This publication has 38 references indexed in Scilit:
- Memory-safe Execution of C on a Java VM2015
- CHERI: A Hybrid Capability-System Architecture for Scalable Software Compartmentalization2015
- LibVM: an architecture for shared library sandboxingSoftware: Practice and Experience, 2014
- RockSalt2012
- ARMor2011
- Frontiers of Chemistry in Paris (Eur. J. Org. Chem. 5/2010)European Journal of Organic Chemistry, 2010
- SingularityACM SIGOPS Operating Systems Review, 2007
- Stack-based typed assembly languageJournal of Functional Programming, 2002
- From system F to typed assembly languageACM Transactions on Programming Languages and Systems, 1999
- Dealing with disaster1996