A rust WebAssembly-eBPF runtime for wasm-bpf project based on libbpf and wasmtime.
Not finished yet! DO NOT USE IT DIRECTLY!
Wasm-bpf
is a WebAssembly eBPF library, toolchain and runtime powered by CO-RE(Compile Once – Run Everywhere) libbpf. It can help you build almost every eBPF programs or usecases to Wasm
.
General purpose
: provide most abilities from eBPF to Wasm,polling
from the ring buffer or perf buffer, bidirectional communications betweenkernel
eBPF anduserspace
Wasm usingmaps
, dynamicallyloading
,attaching
ordetaching
, etc. Supports a large number of eBPF program types and map types.High performance
: Noserialization
overhead for complex data types, usingshared memory
to avoid copy overhead between host and Wasm.Easy to use
: provide a similar developing experience as the libbpf-bootstrap,auto generate
the Wasm-eBPF skeleton headers and type definitions for bindings.Ultralightweight
: the sample runtime has only1.5 MB
in binary size. Compiled Wasm module would be only~90K
. With the same toolchain, you can easily build your own Wasm-eBPF runtime in any languages and platforms!
See the examples directory for examples of eBPF programs written in C, Rust and compiled to Wasm, covering the use cases from tracing
, networking
to security
.
For tools to distribute Wasm-eBPF programs in OCI
images, please refer to eunomia-bpf repo.
- wasm-bpf GitHub Repository: https://github.com/eunomia-bpf/wasm-bpf
- eunomia-bpf project: simplify and enhance eBPF with CO-RE and WebAssembly https://github.com/eunomia-bpf/eunomia-bpf
- documents and blogs: https://eunomia-bpf.github.io/blog/ebpf-wasm.html
- CO-RE (Compile Once – Run Everywhere): https://facebookmicrosites.github.io/bpf/blog/2020/02/19/bpf-portability-and-co-re.html
- WAMR (WebAssembly Micro Runtime): https://github.com/bytecodealliance/wasm-micro-runtime
- wasmtime: https://wasmtime.dev/
- libbpf: https://github.com/libbpf/libbpf