Whats Ebpf
๐ง What is eBPF?
eBPF (extended Berkeley Packet Filter) is a powerful Linux kernel technology that allows safe, sandboxed programs to run inside the kernel โ without modifying kernel code or loading unsafe modules.
It effectively allows you to:
๐ Observe, control, and optimize kernel-level behavior dynamically and safely.
๐ง What eBPF Can Do
Use Case | Example |
---|---|
๐ Observability | Track network calls, CPU/memory usage, syscall latencies |
๐ Security | Monitor or block suspicious system calls, container activity |
๐ Networking | Build firewalls, traffic shaping, load balancers (e.g. Cilium) |
โ๏ธ Profiling | Live CPU flamegraphs, stack traces, I/O bottlenecks |
๐งช Tracing | Distributed tracing with low overhead (e.g. Coroot, Pixie) |
๐ฆ How It Works (Simplified)
- You write a tiny program (in C or use a tool like bpftrace).
- Itโs compiled into eBPF bytecode.
- The kernel verifies the code (ensures itโs safe).
- Itโs loaded into the kernel and hooked to an event (e.g., network packet, syscall, tracepoint).
- It runs in a sandboxed VM inside the kernel with near-zero overhead.
๐ Why Itโs Safe
- eBPF code is verified before execution.
- It runs in a sandbox (no memory access outside bounds).
- It cannot crash the kernel.
๐ฅ eBPF Power Examples
bcc
/bpftrace
โ Observe kernel-level events (like strace++ on steroids)- Pixie / Coroot โ Use eBPF to trace services and monitor latency without instrumenting code
- Cilium โ An eBPF-powered networking and security layer for Kubernetes
๐ Summary
eBPF = kernel superpower for visibility, security, and performance โ used by modern tools like Coroot, Pixie, Cilium, and more.