Session

Rust for Linux Networking Tutorial

Instructors

Wedson Almeida Filho
Miguel Ojeda

Label

Nuts and Bolts

Session Type

Tutorial

Contents

Description

Rust is a systems programming language that is making great strides in becoming the next big one in the domain. Rust for Linux is the project adding support for the Rust language to the Linux kernel.

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 we will build an example kernel side C server. Then, we will migrate it to Rust step-by-step, explaining how the language works at a high-level as well as giving practical tips to get started with Rust for networking in the kernel.

We will also see how Rust prevents some of the mistakes that could have been made in the C version, some of which could become vulnerabilities. We will discover how much code we managed to write in the safe Rust subset for our server, which prevents those issues.

There is no prerequisite Rust knowledge needed for this tutorial.