TL;DR
WebAssembly (Wasm) provides excellent sandboxing and portability, but running complex legacy applications outside the browser is heavily restricted by a lack of mature system interfaces. This paper introduces thin kernel interfaces (like WALI for Linux and WAZI for Zephyr RTOS) that safely expose native operating system syscalls directly to Wasm modules. This bottom-up virtualization approach allows unmodified legacy software stacks to run securely at near-native speeds with millisecond startup times.
What Problem Does This Paper Address?
While WebAssembly has successfully expanded from browsers to cloud and edge computing, its core specification defines only a portable bytecode ISA—it completely lacks system interfaces. The current standardized solution, WASI (WebAssembly System Interface), attempts to build a clean, OS-agnostic, capability-based security API from scratch.
However, WASI is highly complex, constantly evolving, and lacks support for fundamental OS features like memory-mapping (mmap), processes, and asynchronous signals. As a result, developers cannot run existing, real-world software stacks (especially legacy codebases in embedded, automotive, or industrial IoT settings) without massive, impractical refactoring. The authors address this gap by asking a pragmatic question: instead of inventing a brand-new system API, why not safely virtualize the stable, de facto standard that already exists—the native OS syscall interface?
Methods
The authors propose a "bottom-up" virtualization paradigm using thin kernel interfaces that faithfully model the underlying operating system without breaking Wasm's intra-process sandbox. They demonstrate this with two implementations: WALI (WebAssembly Linux Interface) and WAZI (WebAssembly Zephyr Interface).
Key architectural techniques include:
- Address-Space Translation: Safely translating 32-bit Wasm linear memory pointers to host process pointers to enable high-performance, zero-copy I/O.
- Sandboxed Memory Mapping: Allowing applications to use
mmapandmunmapnatively by dynamically managing allocations inside Wasm's isolated linear memory space. - Asynchronous Signal Handling: Emulating native OS signals by registering host-level handlers that queue signals, which are then safely dispatched to Wasm callback functions at compiler-inserted safepoints (e.g., loop headers) to maintain execution consistency.
- Ecosystem Layering: Proving that higher-level capability APIs like WASI don't need to be baked into the Wasm engine. Instead, they can be compiled into Wasm modules and layered cleanly on top of WALI, drastically shrinking the engine's Trusted Computing Base (TCB).
Datasets
The system was evaluated using a suite of popular, complex real-world Linux applications and test suites:
- Applications:
bash(shell),lua(interpreter),sqlite3(database),memcached(system daemon), andpaho-mqtt(IoT communication). - Validation: The Linux Test Project (LTP) was used to verify the correctness and completeness of the virtualized syscall layer.
Key Insights and Ideas
- The Syscall Pareto Principle: You don't need to virtualize all 500+ Linux syscalls to be useful. Dynamic and static analysis reveals that a core subset of roughly 140–150 syscalls is entirely sufficient to run the vast majority of complex applications.
- Decoupling Features from Security: WASI couples feature completeness with a strict security model, making it slow to mature. Thin kernel interfaces decouple them: WALI provides the features by mirroring the host OS, while complex security policies (like seccomp or WASI itself) can be implemented as modular Wasm layers on top.
- Armor for Legacy Code: By compiling legacy C/C++ applications to Wasm+WALI, they automatically inherit Wasm's built-in Control Flow Integrity (CFI) and protection against arbitrary code execution (RCE), effectively neutralizing critical bugs like the recent regreSSHion vulnerability in OpenSSH.
Key Results
- Zero-Modification Porting: Complex applications like
bashandsqlite3compiled and executed perfectly without a single line of source code modification. Furthermore, a popular WASI library (libuvwasi) ran unmodified over WALI, passing all 22 unit tests. - Negligible Syscall Overhead: Most WALI syscalls add only a few hundred nanoseconds of latency. For macrobenchmarks, less than 1% of total execution time is spent inside the WALI interface layer.
- The Virtualization Sweet Spot: WALI strikes a highly efficient middle ground between container virtualization (Docker) and ISA emulation (QEMU). It achieves millisecond-level startup times (orders of magnitude faster than Docker) and avoids the massive execution slowdowns of pure software emulators like QEMU.
Limitations and Future Work
- Threading Overhead: The
clonesyscall for spawning threads currently introduces a ~500µs overhead. This is a limitation of the underlying Wasm engine's (WAMR) thread manager rather than WALI itself, and could be mitigated using lazy loading or copy-on-write paging optimizations. - Processor-Specific Constraints: Features that rely on direct hardware access or architecture-specific structures (like
ucontextfor user-space context switching) are explicitly unsupported to maintain strict ISA portability. - Future Outlook: The authors plan to automate the generation of remaining passthrough syscalls and leverage WALI to accelerate the deployment of the new WASI preview2 standard across diverse, resource-constrained edge runtimes.
Summary updated