Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ WALI Public
forked from arjunr2/WALI

A low-level virtualization interface for Linux-based systems using WebAssembly

License

Notifications You must be signed in to change notification settings

bigwhoman/WALI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webassembly Linux Interface (WALI)

WebAssembly Linux Interface

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

Component Setup

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!:

  1. WALI Engine

I want to compile/build WALI executables!:

  1. WALI LLVM Toolchain
  2. WALI Sysroot

I want to AoT compile the Wasm executables to go fast!

  1. AoT Compiler

1. WALI Engine

We include a baseline implementation in WAMR. To build:

git submodule update --init wasm-micro-runtime
# Generates `iwasm` symlink in root directory
make iwasm

See Sample Applications for test binaries.

WASM as a Miscellaneous Binary Format!

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 -p

More information about miscellaneous binary formats and troubleshooting can be found here

2. WALI LLVM Toolchain

git submodule update --init llvm-project
make wali-compiler

NOTE: 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.

3. WALI Sysroot

git submodule update --init wali-musl
make libc

We currently support 64-bit architectures (x86-64, aarch64, riscv64) with hopes to expand to more architectures.

4. AoT Compiler

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 threads

Building Applications with WALI

Building a "Hello World"

To 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>

Build System Plugins

We provide three configuration files with toolchain requirements, drastically easing plug-in into major builds

  1. Shell: Source the wali_config.sh (see tests/compile-wali.sh)
  2. Make: Include wali_config.mk (see applications/Makefile)
  3. CMake: The wali_config_toolchain.cmake file can be used directly in CMAKE\_TOOLCHAIN\_FILE

Sample Applications

  • Tests: Build with make tests. Executables are located in tests/wasm.
  • Apps: The sample-apps directory has few several popular prebuilt binaries to run

Compiler Ports

Rust

Note: Preliminary support for a wasm32-wali-linux-musl target 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 rustc

This adds a new toolchain to rustup named wali with the new target. To compile applications:

cargo +wali build --target=wasm32-wali-linux-musl

Note: Many applications will currently require a custom libc to be patched into Cargo.toml for the out-of-tree build.

Project Motivation

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

Resources

About

A low-level virtualization interface for Linux-based systems using WebAssembly

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 80.4%
  • Shell 7.6%
  • Roff 5.8%
  • M4 2.9%
  • Makefile 1.0%
  • Jupyter Notebook 0.6%
  • Other 1.7%