So you've heard of Rust and you have heard, while walking around the grape vine, about Rust for Linux. You are a hardcore linux kernel hacker and you love your C. You scratch your head as you wonder why in the world would anyone need another language! But at the same time you cant stand all those annoying pesty syzkaller bug reports or CVEs on your code - they take away all the fun.
Rust has a key property that makes it very interesting as the second language in the kernel: it guarantees no undefined behavior takes place (as long as unsafe code is sound). This includes no use-after-free mistakes, no double frees, no data races, etc. It also provides other important benefits, such as improved error handling, stricter typing, sum types, pattern matching, privacy, closures, generics, etc.
In this tutorial two of the gurus in Rust for Linux, Wedson Almeida Filho and Miguel Ojeda will guide us through a practical example which will use an example of kernel networking code. The sample code is first written in C and then migrated to Rust. Wedson and Miguel will then do a step-by-step walk of the Rust incarnation of the code, explaining how the language works at a high-level and well as giving practical tips to get started with Rust for networking in the kernel.
Our esteemed guides will show us how Rust prevents some of the mistakes that could happen in the C version, some of which could become vulnerabilities exploited by bad operators or that pesky syzkaller.
There is no prerequisite Rust knowledge needed for this tutorial.
cheers, jamal