Brussels / 4 & 5 February 2023


Rust in the Kernel (via eBPF)

Writing eBPF programs in Rust with Aya

Linux kernel already supports writing modules in Rust. There is also an ongoing effort of rewriting Linux subsystems in eBPF (for example HID-BPF). It almost feels like there is an ongoing race between Rust and eBPF to implement parts of the kernel, but both can be done at the same time - by writing eBPF programs in Rust with Aya!

Aya is an eBPF library built with a focus on operability and developer experience. It allows for both user-land and kernel-land programs to be written in Rust - and even allows for sharing of code between the two! It has minimal dependencies. When linked with musl, it creates a truly portable, self-contained binary that can be deployed on many Linux distributions and kernel versions.

In this talk I would like to deep dive into the present state of Aya, with focus on:

  • How it works
  • Currently supported features
  • How Rust for Linux and Aya can benefit from each other
  • Our plans about BTF and CO-RE support, which is already being implemented and includes changes in Rust ecosystem


Michal Rostecki