- FIRST CHOICE
- tracepoint
- FAST FUNC
- fentry/fexit
- SECURITY
- eBPF LSM
- FALLBACK
- kprobe
- kernel event trigger
- telemetry / policy ok
- LSM deny / PMU sample
Start with static tracepoints for stability, reach for fentry/fexit when tracing internal functions on modern BTF kernels, and use LSM when you need to enforce rather than merely watch.
Always tier high-frequency hooks behind dynamic bpf_link toggles so diagnostics stay cheap under peak load.
Tracing & security hook matrix
| Tracepoint | Fentry / Fexit | Kprobe / LSM | |
|---|---|---|---|
| Stability | Maintainer ABI | Kernel symbol | Symbol / LSM ABI |
| Invocation cost | Very low | Lowest (trampoline) | Higher / Sync gate |
| Can block? | No (observe) | No (observe) | No / Yes (LSM) |
| Best fit | Metrics & drops | Deep profiling | Ad-hoc / Policy |