A (Nearly-Complete) Linux API for WebAssembly!
This is a result of work published at EuroSys 2025 on Empowering WebAssembly with Thin Kernel Interfaces (arxiv version available here)
This repo contains all the compiler and engine prototypes for an implementation of the WebAssembly Linux Interface. A list of supported syscalls can be found here
Before proceeding, make sure all dependencies are installed with sudo ./apt-install-deps.sh.
There are four major toolchain components, that may be incrementally built:
I just want to run WALI Wasm executables!:
I want to compile/build WALI executables!:
I want to AoT compile the Wasm executables to go fast!
We include a baseline implementation in WAMR. To build:
git submodule update --init wasm-micro-runtime
# Generates `iwasm` symlink in root directory
make iwasmSee Sample Applications for test binaries.
WALI Wasm/AoT binaries can be executed like ELF files with iwasm (e.g. ./bash.wasm --norc).
This simplifies all builds and is necessary to compile some applications in our repo.
To do this, run:
cd misc
source gen_iwasm_wrapper.sh
# Default binfmt_register does not survive reboots in the system
# Specify '-p' option to register with systemd-binfmt for reboot survival
sudo ./binfmt_register.sh -pMore information about miscellaneous binary formats and troubleshooting can be found here
git submodule update --init llvm-project
make wali-compilerNOTE: Building the LLVM suite takes a long time and can consume up to 150GB of disk. The compiler is essential if you want to rebuild libc or build applications.
git submodule update --init wali-musl
make libcWe currently support 64-bit architectures (x86-64, aarch64, riscv64) with hopes to expand to more architectures.
Generates faster ahead-of time compiled executables. For our WAMR implementation, build with:
make wamrc
Refer to WAMR compiler docs for more info.
The wamrc symlink can be used as follows:
wamrc --enable-multi-thread -o <destination-aot-file> <source-wasm-file> # We require --enable-multi-thread flag for threadsTo build a simple C file, you can run the following on a Bash shell:
# This file provides appropriate compilation flags as environment variables (e.g. WALI_CC, WALI_LD, WALI_CFLAGS, WALI_LDFLAGS)
source wali_config.sh
$WALI_CC $WALI_CFLAGS $WALI_LDFLAGS <c-file> -o <output-file>We provide three configuration files with toolchain requirements, drastically easing plug-in into major builds
- Shell: Source the wali_config.sh (see tests/compile-wali.sh)
- Make: Include wali_config.mk (see applications/Makefile)
- CMake: The wali_config_toolchain.cmake file can be used directly in
CMAKE\_TOOLCHAIN\_FILE
- Tests: Build with
make tests. Executables are located intests/wasm. - Apps: The sample-apps directory has few several popular prebuilt binaries to run
Note: Preliminary support for a
wasm32-wali-linux-musltarget has been upstreamed to rustc! Support for this target requires several ecosystem components to ratchet up to something usable long-term stability, and may hence currently be broken. Use the below out-of-tree build process for rustc if you need a stable target as a proof-of-concept.
We support a custom Rust compiler with a wasm32-wali-linux-musl target.
Existing cargo and rustup are required for a successful build.
To build rustc, run:
make rustcThis adds a new toolchain to rustup named wali with the new target.
To compile applications:
cargo +wali build --target=wasm32-wali-linux-muslNote: Many applications will currently require a custom libc to be patched into
Cargo.tomlfor the out-of-tree build.
The WALI for WebAssembly aims to push lightweight virtualization down to prevalent, low-level Linux applications. WALI adopts a layering approach to API design, allowing WASI (and other arbitrary Wasm APIs) to be virtualized over it, establishing infrastructure for Wasm both in research and industry.
Building and running Wasm binaries is now trivial with WALI, while improving ecosystem security by layering Wasm APIs
- Wasm possesses different runtime properties than some lower level languages like C (type-safety, sandboxing, etc.). The operation of WALI on these applications may differ as listed here
- Zenodo Ubuntu 22.04 VM artifact for experimenting with WALI
- Syscall Information Table
- Related Work: Verifying System Interfaces Paper