4 ms·
> In eBPF, all branches need to jump forward, That was true of cBPF, but eBPF simply requires that the kernel's verifier could convert the control flow graph i
by monocasa 5y ago
> In eBPF, all branches need to jump forward,
That was true of cBPF, but eBPF simply requires that the kernel's verifier could convert the control flow graph into a DAG. So notably certain types of bounded loops are allowed, and generally both back and forward branches are allowed.
- KMag 5y agoOh, interesting. But if the DAG requirement still stands, then it can still be converted into forward-only branches. Why not force that work into the bytecode compiler (or macro assembler) and simplify the kernel logic?
- monocasa 5y agoBecause bounded loops are functionally a compression scheme on the graph. It's a tradeoff for sure though. Personally (and going way off into the weeds, these are my thoughts and not at all representative of people working on BPF) I'd also like to see other schemes eventually that also don't necessarily require verifiable halting semantics for correctness. One example: something like io_uring, but instead there's a program running just barely in kernel space, accounted to the host user thread's scheduling, issuing new syscalls already on the kernel side of the syscall boundary.