Share
Embed
Aladdin & the eBPF lamp: Travel in the kernel
Donia Chaiehloudj
October 16, 2025
Transcript
64 slides
-
Aladdin & the eBPF lamp Travel in the kernel Donia
Chaiehloudj, Software Engineer & Community Isovalent @Cisco -
The Mysterious Cave The Kernel of Wonders... with Rules To
change the Kernel: Rebuild the kernel Load modules Risky for adventurers... -
Program App The Magic eBPF Lamp And Events Userspace Syscalls
Linux Kernel event -
Program App The Magic eBPF Lamp And Events Events tracepoints
kprobes (kernel) uprobes (user) TC (Traffic Control) XDP (Express Datapath) Userspace Syscalls Linux Kernel event -
App Program Verifier The Magic eBPF Lamp is Safe eBPF
programs are: verified sandboxed You can’t crash your kernel. Userspace Syscalls Linux Kernel load eBPF programs -
App Program Verifier JIT Compiler approved The Magic eBPF Lamp
is Safe eBPF programs are: verified sandboxed You can’t crash your kernel. Userspace Syscalls Linux Kernel load eBPF programs -
The Magic eBPF Lamp has Maps for what’s is hidden
in the cave Userspace Syscalls Linux Kernel App eBPF maps Program BPF_MAP_TYPE_HASH BPF_MAP_TYPE_ARRAY BPF_MAP_TYPE_PERCPU_HASH ... -
The Magic eBPF Lamp has Maps for what’s is hidden
in the cave Userspace Syscalls Linux Kernel App eBPF maps read Use Cases: kernel → userspace write Program BPF_MAP_TYPE_HASH BPF_MAP_TYPE_ARRAY BPF_MAP_TYPE_PERCPU_HASH ... -
The Magic eBPF Lamp has Maps to load configuration in
the cave... Use Cases: kernel → userspace userspace → kernel Userspace Syscalls Linux Kernel App eBPF maps read write Program BPF_MAP_TYPE_HASH BPF_MAP_TYPE_ARRAY BPF_MAP_TYPE_PERCPU_HASH ... -
The Magic eBPF Lamp has Maps to transport information within
the cave... Use Cases: kernel → userspace userspace → kernel kernel → kernel Userspace Syscalls Linux Kernel App eBPF maps write Program Program read BPF_MAP_TYPE_HASH BPF_MAP_TYPE_ARRAY BPF_MAP_TYPE_PERCPU_HASH ... -
→ SDKs like cilium/ebpf let you write networking/security tooling +
= Go the companion to travel easy The Flying Carpet -
Go the companion to travel easy The Flying Carpet Userspace
Syscalls Linux Kernel App ELF Object load -
Go the companion to travel easy The Flying Carpet Userspace
Syscalls Linux Kernel App C Program ELF Object load clang -
Go the companion to travel easy The Flying Carpet Userspace
Syscalls Linux Kernel eBPF maps BPF_MAP_TYPE_HASH BPF_MAP_TYPE_ARRAY BPF_MAP_TYPE_PERCPU_HASH ... App C Program ELF Object load clang -
Go the companion to travel easy The Flying Carpet Userspace
Syscalls Linux Kernel eBPF maps BPF_MAP_TYPE_HASH BPF_MAP_TYPE_ARRAY BPF_MAP_TYPE_PERCPU_HASH ... App C Program ELF Object load clang write read -
Wish #1: Becoming a Prince Tracing Capability / Open file
example Step 1: Write C program -
Wish #1: Becoming a Prince Tracing Capability / Open file
example Step 1: Write C program ✅ -
Wish #1: Becoming a Prince Tracing Capability / Open file
example //go:generate go run github.com/cilium/ebpf/cmd/bpf2go tracing tracing.c Step 1: Write C program ✅ Step 2: Use friendly APIs to load programs cilium/ebpf library -
Wish #1: Becoming a Prince Tracing Capability / Open file
example //go:generate go run github.com/cilium/ebpf/cmd/bpf2go tracing tracing.c Step 1: Write C program ✅ Step 2: Use friendly APIs to load programs cilium/ebpf library type openfileObjects struct { openfilePrograms openfileMaps openfileVariables } eBPF Objects to manipulate -
Wish #1: Becoming a Prince Tracing Capability / Open file
example //go:generate go run github.com/cilium/ebpf/cmd/bpf2go tracing tracing.c Step 1: Write C program ✅ Step 2: Use friendly APIs to load programs cilium/ebpf library type openfileObjects struct { openfilePrograms openfileMaps openfileVariables } eBPF Objects to manipulate eBPF program bytecodes type openfilePrograms struct { TraceOpenat *ebpf.Program `ebpf:"trace_openat"` } -
Wish #1: Becoming a Prince Tracing Capability / Open file
example Step 1: Write C program ✅ Step 2: Use friendly APIs to load programs cilium/ebpf library ✅ -
Wish #1: Becoming a Prince Tracing Capability / Open file
example Step 1: Write C program ✅ Step 2: Use friendly APIs to load programs cilium/ebpf library ✅ Step 3: Write Go program to load eBPF program -
Wish #1: Becoming a Prince Tracing Capability / Open file
example Step 1: Write C program ✅ Step 2: Use friendly APIs to load programs cilium/ebpf library ✅ Step 3: Write Go program to load eBPF program ✅ -
Moral #1 “We didn’t recompile the application. We didn’t stop
the kingdom. We simply saw. Like Aladdin dressed in fine silk, we gain legitimacy, we can observe from the inside… with grace.” -
🥷 The Threat: “Jafar Strikes” A noisy neighbor A suspicious
IP A storm of a packets at the gate -
Moral #2 When the sea turns rough, eBPF can pull
you to the surface—not with blunt force, but with elegant control at the kernel’s edge.” -
pods The Magic eBPF Lamp And Events One kernel for
all the containers Userspace Syscalls Linux Kernel -
pods The Magic eBPF Lamp And Events One kernel for
all the containers Userspace Syscalls Linux Kernel event -
Program pods The Magic eBPF Lamp And Events One kernel
for all the containers Userspace Syscalls Linux Kernel event -
Wish #3: Freeing the eGenie Cilium as the default Cloud
Networking Interface (CNI) Amazon EKS Anywhere Anthos GKE Dataplane v2 Azure Kubernetes Service Azure Kubernetes Service source: https://cilium.io/use-cases/cni/ Managed Kubernetes Service MetaKube -
Wish #3: Freeing the eGenie From Tools to Ecosystem in
Security - Tetragon -
Moral #3 When the eGenie is free, standardized, open source,
integrated, everyone benefits: platform teams, developers, security, and ultimately… users.” -
Key Takeways Write tiny, safe eBPF Program without rebooting Abstract
syscalls, make programs practical, maintainable. -
Key Takeways Write tiny, safe eBPF Program without rebooting Abstract
syscalls, make programs practical, maintainable. Wish #1: Tracing Wish #2: Security XDP Wish #3: Networking k8s Palace -
It’s not about power, it’s about wisdom. Use the genie
well. Free it into the ecosystem. Build tools that help everyone. Key Takeways Write tiny, safe eBPF Program without rebooting Abstract syscalls, make programs practical, maintainable. Wish #1: Tracing Wish #2: Security XDP Wish #3: Networking k8s Palace