eBPF Explained: Programmable Linux Kernel for Networking, Security and Observability
What eBPF is, how verified programs run safely in the Linux kernel, hooks like kprobes and XDP, maps, and why tools like Cilium, Falco and bpftrace use it.
Published December 4, 2026
eBPF lets you run small, sandboxed programs inside the Linux kernel without writing kernel modules or rebooting. It has quietly become the foundation of modern cloud-native networking (Cilium), runtime security (Falco, Tetragon), observability and profiling. Understanding what it is explains why so many tools can now see and control system behaviour with very low overhead.
The concept
An eBPF program is compiled to bytecode, loaded into the kernel, checked by the verifier (which guarantees it terminates, accesses memory safely and cannot crash the kernel), then JIT-compiled to native code and attached to a hook. Hooks include kprobes and uprobes (function entry and exit in the kernel or user programs), tracepoints, network hooks such as XDP and tc, cgroup hooks and LSM security hooks.
Programs share data with user space through maps: hash tables, arrays, ring buffers and more. A user-space agent loads programs, reads maps and exports results. Because the work happens in the kernel at the event source, eBPF tools can observe every syscall, packet or function call with far less overhead than older approaches like sidecars or ptrace-based tracing.
How eBPF works
What it is used for
| Area | What eBPF enables | Tools |
|---|---|---|
| Networking | Fast packet processing, load balancing, policies without iptables | Cilium, Katran, XDP programs |
| Security | Runtime detection and enforcement of syscalls, file and network activity | Falco, Tetragon, Tracee |
| Observability | Per-request latency, network flows without code changes | Hubble, Pixie, Grafana Beyla |
| Profiling / tracing | Low-overhead CPU profiling, ad-hoc kernel tracing | bpftrace, Parca, Pyroscope eBPF |
Why it is efficient
Practical examples
One-liners with bpftrace
Ad-hoc tracing on a live system (needs root and a recent kernel).
# Which processes open which files?
sudo bpftrace -e 'tracepoint:syscalls:sys_enter_openat { printf("%s %s\n", comm, str(args->filename)); }'
# Histogram of read() sizes
sudo bpftrace -e 'tracepoint:syscalls:sys_exit_read /args->ret > 0/ { @bytes = hist(args->ret); }'List loaded eBPF programs
bpftool inspects programs and maps.
sudo bpftool prog list | head
sudo bpftool map list | headCheck kernel support
Most features need a modern kernel (5.x+) with BTF.
uname -r
ls /sys/kernel/btf/vmlinux && echo "BTF available"Common mistakes
- Assuming eBPF programs can do anything; the verifier restricts loops, memory access and size.
- Running eBPF tools on old kernels without BTF and hitting compatibility issues.
- Treating eBPF security tools as a replacement for patching and least privilege.
- Granting CAP_BPF/CAP_SYS_ADMIN to untrusted workloads.
Key takeaways
- eBPF runs verified, sandboxed programs inside the Linux kernel.
- Programs attach to hooks and share data via maps.
- It powers modern networking, security and observability tools.
- Use a modern kernel and treat eBPF privileges as highly sensitive.
FAQ
Do I need to write eBPF programs myself?
Usually not. Most teams use tools built on eBPF; writing programs is mainly for tool authors or specialised needs.
Does eBPF work on Windows?
There is an eBPF for Windows project, but the Linux ecosystem is far more mature.
Is eBPF safe?
The verifier prevents crashes and unsafe memory access, but loading programs is a privileged operation and must be controlled.