3 ms·
eBPF programs cannot crash the kernel, assuming there are no bugs in the eBPF verifier. There have been such bugs in the past but they seem to be getting more a
by School-Cotton 2y ago
eBPF programs cannot crash the kernel, assuming there are no bugs in the eBPF verifier. There have been such bugs in the past but they seem to be getting more and more rare.
- throwaway984393 2y ago[dead]
- javierhonduco 2y agoOr in other parts of the kernel. It's been the case in multiple occasions that buggy locking (or more generalised, missing 'resource' release) has caused problems for perfectly safe BPF programs. For example, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033398 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033398 and the fix https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/mm/maccess.c?id=d319f344561de23e810515d109c7278919bff7b0 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
- School-Cotton 2y agoThis is actually exactly the bug I was thinking of, so fair point! (I work at PS now and am aware you worked on debugging it a while back).
- rwmj 2y agoThis isn't really true. eBPF programs in Linux have access to a large set of helper functions written in plain C. https://lwn.net/Articles/856005/ https://lwn.net/Articles/856005/
- School-Cotton 2y agoI don't see how this contradicts what I said. Indeed, there are helpers, but the verifier is supposed to check that the eBPF program isn't calling them with invalid arguments.
- queuebert 2y agoI would be very hesitant to say "cannot" in a million-line C code base.
- School-Cotton 2y agoYes, bugs in Linux are possible, so there might be some eBPF code that crashes the kernel. Just like bugs in Chrome are possible, so there might be some JavaScript that crashes the browser. Still, JavaScript is much safer than native code, because fixing the bugs in one implementation is a tractable problem, whereas fixing the bugs in all user code is not.