A tale about fixing eBPF spinlock issues in the Linux kernel
Summary
The article recounts diagnosing and patching an eBPF spinlock issue in the Linux kernel affecting a ring-buffer used by a CPU profiler. It details the race between two eBPF programs (context switch and sampling) on the same CPU, the deadlock/watchdog checks, and the patch that updates the per-CPU held-lock table before acquiring the lock to prevent NMIs from causing freezes; it also covers follow-on fixes and backports.