Chapter 1. What Is eBPF, and Why Is It Important?
eBPF is a revolutionary kernel technology that allows developers to write custom code that can be loaded into the kernel dynamically, changing the way the kernel behaves. (Don’t worry if you’re not confident about what the kernel is—we’ll come to that shortly in this chapter.)
This enables a new generation of highly performant networking, observability, and security tools. And as you’ll see, if you want to instrument an app with these eBPF-based tools, you don’t need to modify or reconfigure the app in any way, thanks to eBPF’s vantage point within the kernel.
Just a few of the things you can do with eBPF include:
-
Performance tracing of pretty much any aspect of a system
-
High-performance networking, with built-in visibility
-
Detecting and (optionally) preventing malicious activity
Let’s take a brief journey through eBPF’s history, starting with the Berkeley Packet Filter.
eBPF’s Roots: The Berkeley Packet Filter
What we call “eBPF” today has its roots in the BSD Packet Filter, first described in 1993 in a paper1 written by Lawrence Berkeley National Laboratory’s Steven McCanne and Van Jacobson. This paper discusses a pseudomachine that can run filters, which are programs written to determine whether to accept or reject a network packet. These programs were written in the BPF instruction set, a general-purpose set of 32-bit instructions that closely resembles assembly language. Here’s an example taken directly from that ...