xBPF (eXtended BPF) is a high-level eBPF library for Rust. It aims at providing an ergonomic and light-weight interface to eBPF.
eBPF can be a bit of a footgun: Building, loading, and managing eBPF programs is not necessarily difficult, but can fail in many spectacular ways. xBPF addresses this with convenient helper functions that avoid common pitfalls, and reduce boiler plate code.
Note
xBPF is still very much WIP. Feel free to open issues if you find bugs or have a feature request!
xBPF is comparable to aya, but requires you to write your eBPF code in C, rather than Rust. In my opinion, implementing eBPF with Rust makes things unnecessarily complicated. eBPF is hard because it's verified. Using Rust in this case might seem convenient, but does not help the kernel verify your programs.
But alternatives like libbpf-rs are much more low level. Using it can be a pretty steep learning curve.
xBPF closes this gap by building on top of libbpf-rs to provide a more user-friendly eBPF ecosystem for Rust.
This project is licensed under the MIT license.
