4 ms·
I believe he is saying that eBPF will disallow certain code to run if it doesn’t meet the standards listed by the parent comment. The article also mentions that
by Dangeranger 7y ago
I believe he is saying that eBPF will disallow certain code to run if it doesn’t meet the standards listed by the parent comment. The article also mentions that eBPF will check whether code is “worthy” or running or rearrange it so that it is worthy.
The idea is to compile to assembly which both fixes the bug, and is runnable by eBPF.
- majke 7y agoApologies. Indeed, not all generated clang eBPF is loadable eBPF. So we can sum up: - Clang can compile C - eBPF backend can generate the eBPF bytecode for subset of IR (AFAIU not all IR, not all "C" is okay for eBPF) - verifier can accept or reject the generated eBPF. The goal is to write C in such a way that will be generally sensible C but that will consistently yield loadable eBPF programs. This is not easy! Just recently I was debugging code where clang optmizer decided to merge two loads of 2 bytes into one load of 4 bytes. This made the verifier unhappy - the specific loads are rewritten to helper calls by verifier. The verifier knows what to do on 2-byte load at offset X, and 2-byte load at offset X+2. But it has no idea what to do with 4-byte load at offset X! Writing C programs that will compile to valid, loadable eBPF requires a fair amount of voodoo.
- justinclift 7y agoThanks, that makes sense. :) Kind of sounds like having a specific eBPF transformation pass available in LLVM would be useful. eg having it generate known-to-work-with-eBPF output