3 ms·
You don't have to use C. There are two projects that enable writing eBPF with Rust [1][2]. I'm sure there is an equivalent with nicer wrappers for C++. [1] ht
by the_duke 5y ago
You don't have to use C.
There are two projects that enable writing eBPF with Rust [1][2]. I'm sure there is an equivalent with nicer wrappers for C++.
[1] https://github.com/foniod/redbpf https://github.com/foniod/redbpf
[2] https://github.com/aya-rs/aya https://github.com/aya-rs/aya
- tptacek 5y agoIt doesn't make any difference which language you use; the security promises are coming from the verifier, which is analyzing the CFG of the compiled program. C is what most people use, since the underlying APIs are in C, and since the verifier is so limiting that most high-level constructions are off the table.
- the_duke 5y agoSure, I was not implying that Rust would have any security benefits fir eBPF. Just that you can even write eBPF code in more convenient languages.
- tptacek 5y agoThis has come up here a bunch of times (we do a lot of work in Rust). I've been a little skeptical that Rust is a win here, for basically the reason I gave upthread: you can't really do much with Rust in eBPF, because the verifier won't let you; it seems to me like you'd be writing a dialect of Rust-shaped C. But we did a recent work sample challenge for Rust candidates that included an eBPF component, and a couple good submissions used Rust eBPF, so maybe I'm wrong about that. I'm also biased because I love writing C code (I know, both viscerally and intellectually, that I should virtually never do so; eBPF is the one sane exception!)