Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Aladdin & the eBPF lamp: Travel in the kernel

Aladdin & the eBPF lamp: Travel in the kernel

Avatar for Donia Chaiehloudj

Donia Chaiehloudj

October 16, 2025
Tweet

More Decks by Donia Chaiehloudj

Other Decks in Technology

Transcript

  1. Aladdin & the eBPF lamp Travel in the kernel Donia

    Chaiehloudj, Software Engineer & Community Isovalent @Cisco
  2. The Mysterious Cave The Kernel of Wonders... with Rules To

    change the Kernel: Rebuild the kernel Load modules Risky for adventurers...
  3. 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
  4. 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
  5. 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
  6. 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 ...
  7. 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 ...
  8. 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 ...
  9. 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 ...
  10. → SDKs like cilium/ebpf let you write networking/security tooling +

    = Go the companion to travel easy The Flying Carpet
  11. Go the companion to travel easy The Flying Carpet Userspace

    Syscalls Linux Kernel App ELF Object load
  12. Go the companion to travel easy The Flying Carpet Userspace

    Syscalls Linux Kernel App C Program ELF Object load clang
  13. 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
  14. 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
  15. Wish #1: Becoming a Prince Tracing Capability / Open file

    example Step 1: Write C program ✅
  16. 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
  17. 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
  18. 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"` }
  19. 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 ✅
  20. 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
  21. 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 ✅
  22. 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.”
  23. 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.”
  24. pods The Magic eBPF Lamp And Events One kernel for

    all the containers Userspace Syscalls Linux Kernel
  25. pods The Magic eBPF Lamp And Events One kernel for

    all the containers Userspace Syscalls Linux Kernel event
  26. Program pods The Magic eBPF Lamp And Events One kernel

    for all the containers Userspace Syscalls Linux Kernel event
  27. 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
  28. Moral #3 When the eGenie is free, standardized, open source,

    integrated, everyone benefits: platform teams, developers, security, and ultimately… users.”
  29. Key Takeways Write tiny, safe eBPF Program without rebooting Abstract

    syscalls, make programs practical, maintainable.
  30. 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
  31. 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