Announcing Aya

Today I am very excited to announce the first release of aya, a brand new eBPF library for the Rust programming language! Aya differs from the existing eBPF libraries in two important ways:

  • It doesn't have "bpf" in its name - I'm really entering uncharted waters here! ⛵️
  • It doesn't use the libbpf library nor the bcc toolchain. It's a new, pure Rust implementation which uses the libc crate directly to execute syscalls.

Aya was built with a focus on developer experience and operability. It does not require a C toolchain to build and doesn't even require kernel headers. Compiling the crate in release mode takes only a few seconds. ⚡️


This is the first release, but the project has been six months in the making and is already packed with features. The release includes:

  • Support for the BPF Type Format (BTF), which is transparently enabled when supported by the target kernel. This allows eBPF programs compiled against one kernel version to run on other kernel versions without the need to recompile. Layout differences in kernel types are reconciled at run time based on BTF debug info.
  • Support for bpf-to-bpf function calls and global variables and initializers. eBPF programs can be structured like any other program. At runtime, aya will relocate functions according to the format expected by the kernel and transparently load global sections into eBPF maps.
  • Support for many map types including arrays, hash maps, perf arrays, sock maps, sock hash maps, stacks, queues, and stack traces.
  • Support for several program types including programs to implement network filtering at the TC, cgroup and individual socket level, kprobes and uprobes, tracepoints, sockops, sendmsg(), and XDP programs.
  • Opt-in async support with tokio and async-std.
  • Complete API docs hosted at with detailed guides coming soon.

Roadmap & Community

The API is currently unstable, although I'm not expecting it to change drastically. The current plan is to stabilize the API and add support for more eBPF features, aiming to get close to feature parity with libbpf by the end of the year, and then release 1.0 in January 2022.

The aya crate includes the user-space part of aya, in other words what you use to to load, attach and interact with eBPF programs. If you look at the git repository, you'll also see code to write programs in Rust. This part is still in flux and will be released separately. Meanwhile in case you missed it, the rustc BPF target was finally merged last week, so writing eBPF in Rust just became a whole lot easier.

Over the last year I've talked with many folks interested in using eBPF in the Rust community. My goal is to get as many of you involved in the project as possible! Now that the rustc target has been merged, it's time to build a solid foundation so that we can enable developers to write great eBPF enabled apps!

If you run into any problems using the library, please open an issue on github. Aya does not support an eBPF API you are currently using or wish to use? Implement it and create a pull request, or feel free to open an issue. This will help me prioritise future work.

I will be setting up a chat channel for the project, most likely on Zulip, but I'm open to suggestions. If you have any comments or suggestions, feel free to @ me on twitter.