🌐 eBPF BEYOND SECURITY β€” Revolusi di Semua Layer

eBPF bukan hanya tools security. Dia adalah programmable kernel platform β€” seperti JavaScript untuk browser, tapi untuk kernel Linux. Hampir setiap domain computing sedang di-disrupt oleh eBPF.

Konteks

Baca eBPF Security dulu untuk fondasi arsitektur. Dokumen ini fokus ke domain di luar security yang jarang dibahas tapi sama revolusionernya.


Peta Domain yang Diubah eBPF

                    eBPF sebagai Platform
                           β”‚
       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       β”‚                   β”‚                   β”‚
  NETWORKING          OBSERVABILITY        PERFORMANCE
  ──────────          ─────────────        ───────────
  Β· Gantikan iptables  Β· Gantikan strace    Β· CPU profiling
  Β· Load balancer      Β· Gantikan tcpdump   Β· Memory leak
  Β· Service mesh       Β· Distributed trace  Β· GPU workload
  Β· XDP DDoS           Β· Language runtime   Β· Scheduler tune
       β”‚                   β”‚                   β”‚
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚            β”‚            β”‚
         KUBERNETES    ANDROID      WINDOWS
         ──────────    ───────      ───────
         Β· Gantikan    Β· Di kernel   Β· Cross-platform
           kube-proxy    Android     Β· eBPF for Windows
         Β· CNI plugin    sejak 2020  Β· Microsoft invest
         Β· Policy                     besar-besaran

1 β€” Networking: Gantikan iptables Sepenuhnya

Masalah iptables yang Jarang Diketahui

iptables adalah teknologi dari tahun 1998.
Di cluster Kubernetes dengan 5000 service:

iptables rules yang dibuat : ~25.000 rules
Waktu update 1 rule        : ~11 detik (harus reload semua!)
CPU overhead               : linier dengan jumlah rules
Debuggability              : sangat susah β€” rules tidak human-readable

Ini bukan masalah kecil. Di skala besar:
Netflix, Google, Meta tidak bisa pakai iptables.

Solusi eBPF: Cilium + eBPF Maps

eBPF approach:
- Rules disimpan dalam eBPF Hash Maps (O(1) lookup)
- Update rule β†’ update map entry β†’ instant, tidak perlu reload
- 5000 service β†’ sama cepatnya dengan 5 service
- Packet processing di XDP level β€” sebelum stack kernel

Hasil nyata (benchmark Cilium vs iptables):
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Metrik              β”‚ iptables     β”‚ Cilium (eBPF)  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 5000 service update β”‚ ~11 detik    β”‚ <1ms           β”‚
β”‚ Throughput          β”‚ ~1-2 Mpps    β”‚ 10+ Mpps (XDP) β”‚
β”‚ CPU per 1M packets  β”‚ ~30%         β”‚ ~3%            β”‚
β”‚ Memory (5000 svc)   β”‚ ~100MB rules β”‚ ~20MB maps     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Kubernetes: kube-proxy Digantikan

kube-proxy tradisional:
β†’ Komponen Kubernetes yang manage load balancing service
β†’ Pakai iptables atau IPVS di belakangnya
β†’ O(n) complexity β€” makin banyak service, makin lambat

Cilium tanpa kube-proxy:
β†’ eBPF handles semua service routing
β†’ O(1) dengan hash map
β†’ Google GKE, AWS EKS, Azure AKS sudah support Cilium
β†’ Isovalent (Cilium company) diakuisisi Cisco 2024

Plot Twist Industri

Google telah menggunakan eBPF untuk menggantikan iptables di seluruh infrastruktur internal mereka sejak 2016 β€” jauh sebelum Cilium populer. Mereka membangun sistem internal bernama Katran yang kini open-source dan dipakai Meta untuk load balancing Facebook/Instagram.


2 β€” Observability: Gantikan Semua Tools Lama

Yang Digantikan eBPF

Tools LamaMasalahPengganti eBPFKeuntungan
straceOverhead 300-600% β€” memperlambat proses yang di-trace drastisbpftrace + kprobe< 1% overhead, bisa trace production tanpa dampak
tcpdump / WiresharkSemua paket di-copy ke user space β€” overhead besar, tidak scalableeBPF socket filter + XDPHanya copy paket yang relevan, filter di kernel
perf + gprofSampling-based β€” kehilangan event singkat, tidak bisa trace cross-languageBPF profiler (Parca, Pyroscope)Continuous profiling, per-event, cross-language
OpenTelemetry SDKHarus instrumentasi kode manual β€” semua service perlu diubahPixie, OdigosZero-code instrumentation via uprobe
netstat / ssSnapshot β€” tidak bisa lihat yang sudah lewatbpftrace tcp probesReal-time + historical, setiap koneksi tercatat

Distributed Tracing Tanpa Mengubah Kode

Masalah klasik distributed tracing:
Kamu punya 50 microservice β†’ mau tau kenapa request lambat
β†’ Harus tambah OpenTelemetry ke semua 50 service
β†’ Rebuild, redeploy, koordinasi semua tim
β†’ Butuh berbulan-bulan

eBPF approach (Odigos / Pixie):
β†’ Deploy satu eBPF agent per node
β†’ Hook ke ssl_read/ssl_write di OpenSSL (uprobe)
β†’ Otomatis dapat trace end-to-end TANPA ubah kode
β†’ Mendukung: Go, Java, Python, Node.js, Ruby, .NET
β†’ Setup: 10 menit

Cara kerjanya (uprobe magic):
ssl_write dipanggil β†’ eBPF intercept SEBELUM enkripsi
β†’ dapat plaintext data + context (service, trace ID, latency)
β†’ inject trace header β†’ teruskan ke service berikutnya
β†’ reconstruct full distributed trace di user space

Language Runtime Introspection

Ini yang paling mind-blowing: eBPF bisa "masuk" ke dalam
runtime bahasa pemrograman tanpa mengubah kode:

Python:
β†’ Uprobe pada PyEval_EvalFrameEx
β†’ Lihat setiap function call Python yang terjadi
β†’ Flamegraph Python tanpa -fno-omit-frame-pointer
β†’ Detect GIL contention (kenapa Python multi-thread lambat)

Java / JVM:
β†’ Uprobe pada JVM interpreter + JIT compiled methods
β†’ Lihat garbage collection pause secara real-time
β†’ Detect memory leak pattern

Golang:
β†’ Uprobe pada goroutine scheduler
β†’ Lihat goroutine blocking + contention
β†’ Detect goroutine leak

Node.js:
β†’ Uprobe pada V8 engine
β†’ Lihat event loop lag
β†’ Detect callback hell yang nyebabkan latency

3 β€” Performance Engineering: Invisible Profiler

Continuous Profiling di Production

Masalah profiling tradisional:
"Kita tidak bisa profile di production karena overhead terlalu besar"
β†’ Pakai staging, hasilnya tidak representative
β†’ Bug production tidak bisa di-reproduce di staging

eBPF solution (Parca, Pyroscope, Grafana Pyroscope):
β†’ Overhead < 1% CPU
β†’ Bisa jalan 24/7 di production
β†’ Flamegraph per service, per endpoint, per user
β†’ "Kenapa request user A lebih lambat dari user B?"
   β†’ bisa dijawab dengan per-request profiling

Cara deployment:
DaemonSet di setiap node Kubernetes
β†’ Otomatis profile semua container
β†’ Zero config per application
β†’ Hasilnya tersimpan + bisa di-query historical

CPU Scheduler Optimization

eBPF bisa hook ke Linux CPU scheduler (sched_switch, dll)

Use case nyata (Google, Meta):
β†’ Monitor berapa lama task menunggu di run queue
β†’ Detect "noisy neighbor" β€” container yang steal CPU dari yang lain
β†’ Custom scheduling hints via eBPF β†’ latency berkurang 30-40%

Meta menggunakan eBPF untuk:
β†’ Scuba (internal observability) β†’ track scheduling latency
β†’ Tupperware (container platform) β†’ per-container CPU accounting
β†’ Hasil: penghematan ~20% server di beberapa workload

Memory Subsystem Observability

eBPF bisa hook ke:
- Allocator (malloc, kmalloc)
- Page fault handler
- OOM killer
- Swap subsystem
- NUMA migration

Use case:
β†’ Detect memory leak: "proses X allocate tapi tidak free di line 247"
β†’ Identify NUMA inefficiency: "data di NUMA node 0 tapi CPU di NUMA node 1"
β†’ Predict OOM sebelum terjadi: "rate of allocation > rate of free"

Tools: memray (Python), bpftrace scripts, Tetragon (Cilium)

4 β€” Kubernetes & Cloud Native: Fondasi Baru

Service Mesh Tanpa Sidecar

Sidecar pattern (Istio tradisional):
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Pod                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ App      β”‚  β”‚ Envoy β”‚ β”‚
β”‚  β”‚ Containerβ”‚  β”‚Sidecarβ”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Masalah:
- 2x container per pod
- 100-500MB RAM overhead per pod
- Latency tambahan setiap request
- 1000 pod = 1000 Envoy proxy

eBPF Service Mesh (Cilium Mesh, Istio Ambient Mode):
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Pod          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚
β”‚  β”‚ App only β”‚β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     eBPF di kernel node β€” satu instance untuk semua pod

Keuntungan:
- Zero sidecar β†’ resource savings masif
- mTLS di kernel level β†’ latency berkurang
- Policy enforcement tanpa ubah aplikasi
- Google + Istio sudah adopt "ambient mode" (sidecar-less)

Network Policy yang Efisien

NetworkPolicy Kubernetes dengan iptables:
β†’ 1 policy = puluhan iptables rules
β†’ Update policy = reload semua rules
β†’ Tidak support Layer 7 (hanya L3/L4)

NetworkPolicy dengan Cilium eBPF:
β†’ Policy disimpan dalam eBPF maps
β†’ Update instan (O(1))
β†’ Support Layer 7: "allow POST /api/v1/users tapi block DELETE"
β†’ Identity-based: "service A boleh akses service B, bukan berdasarkan IP"
   (IP berubah di Kubernetes β€” identity-based lebih reliable)

5 β€” Android: eBPF Sudah Ada di Smartphone Kamu

Fakta yang jarang diketahui:
Google mengintegrasikan eBPF ke Android kernel sejak Android 9 (2018)
Kernel Android adalah Linux kernel β€” eBPF berjalan di dalamnya

Penggunaan eBPF di Android:
1. Network stats per-app
   β†’ "Aplikasi Instagram menggunakan 50MB data hari ini"
   β†’ Diimplementasi via eBPF, bukan polling
   β†’ Lebih akurat, lebih efisien

2. Battery usage tracking
   β†’ Siapa yang drain battery? eBPF track setiap wakelock
   β†’ Battery Historian pakai data dari eBPF hooks

3. Thermal management
   β†’ Monitor CPU frequency + temperature via eBPF
   β†’ Throttle aplikasi yang berlebihan tanpa restart

4. Security (Android Vendor Initiative)
   β†’ Deteksi malware di kernel level
   β†’ Lebih susah di-bypass dibanding user space scanner

Implikasi:
β†’ Teknik eBPF yang dipelajari di Linux berlaku langsung di Android
β†’ Android security research bisa leverage eBPF
β†’ Custom Android kernel dengan eBPF program = area riset menarik

6 β€” Windows: Microsoft Serius dengan eBPF

2021: Microsoft announce eBPF for Windows
β†’ Open source: github.com/microsoft/ebpf-for-windows
β†’ Bukan port Linux β€” implementasi native di Windows kernel

Arsitektur:
eBPF bytecode β†’ Windows eBPF verifier β†’ JIT β†’ Windows kernel hooks

Hooks yang tersedia di Windows eBPF:
- Network filter (WFP β€” Windows Filtering Platform)
- Socket operations
- Process/thread creation
- Registry operations (Windows-specific hook!)

Use case yang sudah production:
- Microsoft Defender menggunakan eBPF untuk EDR hooks
- Azure menggunakan eBPF untuk network acceleration di VM
- Windows Security Center β†’ beberapa komponen migrasi ke eBPF

Implikasi untuk security researcher:
β†’ Teknik eBPF = berlaku cross-platform (Linux + Windows + Android)
β†’ Satu paradigma, tiga OS besar
β†’ Ini kenapa eBPF disebut "the future of kernel programming"

7 β€” Developer Tools: Debug yang Tidak Mungkin Jadi Mungkin

Time Travel Debugging

Masalah: bug yang hanya muncul sekali setiap 1000 request
β†’ Tidak bisa reproduce
β†’ Logging tidak cukup detail
β†’ Debugger terlalu invasif

eBPF solution:
β†’ Program eBPF record semua syscall, function calls, memory access
β†’ Simpan dalam ring buffer (circular)
β†’ Saat bug terjadi β†’ dump buffer β†’ punya "rekaman" semua yang terjadi
   sebelum bug

Implementasi: rr (Mozilla) + eBPF, Lares (startup yang fokus di ini)

Analogi: dashcam yang terus merekam, simpan 30 detik terakhir
         saat terjadi kecelakaan (bug) β†’ rekaman tersedia

Chaos Engineering yang Presisi

Chaos engineering tradisional:
β†’ Kill pod, inject latency di network level
β†’ Kasar, tidak bisa target kondisi spesifik

eBPF chaos engineering (Chaosblade, Chaos Mesh):
β†’ "Inject latency 100ms HANYA untuk request dari user ID tertentu"
β†’ "Simulasi disk error HANYA untuk file di /var/log/*"
β†’ "Kill koneksi database HANYA setelah 1000 query"
β†’ Presisi surgical β€” tidak perlu matikan seluruh service

Cara kerja:
eBPF hook ke syscall yang relevan
β†’ Intercept berdasarkan kondisi spesifik
β†’ Inject failure sesuai parameter
β†’ Zero impact ke request lain

8 β€” AI/ML Infrastructure: Frontier Baru

GPU Observability (area yang sangat baru):

Masalah:
GPU adalah black box β€” tidak ada visibility apa yang terjadi di dalamnya
"GPU utilization 80%" β€” tapi 80% compute atau 80% memory transfer?

eBPF approach yang sedang dikembangkan:
β†’ Hook ke NVIDIA GPU driver (kernel module)
β†’ Trace setiap CUDA kernel launch
β†’ Lihat: compute time vs memory transfer time per operation
β†’ Detect "GPU idle while waiting for CPU data"

Tools:
- NVIDIA Nsight (traditional, overhead besar)
- eBPF-based GPU profiler (masih eksperimental, startup space)
- Tetragon + GPU hooks (Cilium roadmap)

Inference Optimization:
β†’ eBPF monitor memory bandwidth consumption per model layer
β†’ Detect bottleneck: "attention layer ini memory-bound, bukan compute-bound"
β†’ Inform quantization decision (mana yang worth di-quantize)

Status: sangat early, sangat menarik, hampir tidak ada orang di sini

Ringkasan β€” eBPF vs Tradisional per Domain

DomainTradisionaleBPFImprovement
Firewall/NATiptables (1998)XDP + eBPF maps10x throughput, O(1) updates
Load BalancingIPVS, NginxKatran, CiliumSub-microsecond latency
Service MeshSidecar (Envoy)Sidecar-less eBPF~90% resource savings
Distributed TracingSDK instrumentationuprobe auto-traceZero code change
CPU Profilingperf samplingeBPF continuousPer-event, < 1% overhead
Security Monitoringauditd, kernel moduleFalco eBPF probe10x lebih efisien, zero crash risk
Network Stats (Android)Polling + proc/neteBPF netd hooksReal-time, akurat per-app
Windows EDRKernel callbackseBPF for WindowsPortable, sandboxed
Chaos EngineeringService killeBPF fault injectionSurgical precision

Yang Belum Ada yang Garap β€” Peluang Riset

1. eBPF for GPU Workload Visibility
   β†’ CUDA kernel trace via eBPF hooks di NVIDIA driver
   β†’ Hampir tidak ada paper yang publish

2. eBPF + WebAssembly (WASM)
   β†’ WASM VM berjalan di user space
   β†’ eBPF bisa observe setiap WASM function call via uprobe
   β†’ Security sandbox untuk WASM + eBPF monitoring

3. eBPF for Edge Computing (RISC-V IoT)
   β†’ Resource-constrained eBPF VM untuk edge node
   β†’ Monitoring tanpa overhead agent tradisional

4. eBPF for Quantum Hardware Emulator
   β†’ Track resource usage per quantum gate simulation
   β†’ Optimize qubit simulation scheduling

5. eBPF + LLM Inference
   β†’ Monitor memory bandwidth per transformer layer
   β†’ Inform dynamic quantization decision real-time

Satu Hal yang eBPF TIDAK Bisa Lakukan

eBPF tidak bisa gantikan semua hal:

  • RTOS (VxWorks, Green Hills) β€” tidak support, mungkin tidak akan pernah
  • Bare-metal microcontroller (Arduino, STM32 tanpa Linux) β€” tidak relevant
  • Truly air-gapped system β€” eBPF butuh kernel Linux yang update
  • Firmware sebelum kernel boot β€” eBPF for UEFI masih eksperimental

Untuk 99% sistem Linux modern dari smartphone sampai data center: eBPF adalah masa kini dan masa depan.


πŸ”— Lihat Juga


eBPF Beyond Security | Networking Β· Observability Β· Performance Β· Android Β· Windows Β· AI/ML Β· Peluang Riset