After 30 Years, a Second Language Comes to Linux Kernel

Rust has emerged as a ‘developer darling’ of late.
Listen to this story

“So, as is hopefully clear to everybody, the major version number change is more about me running out of fingers and toes than it is about any big fundamental changes,” wrote Linus Torvalds as he introduced Linux 6.0 earlier this month. He also added, “I’ll open the merge window for 6.1, which—unlike 6.0—has a number of fairly core new things lined up.”

All speculations, which heightened after Torvalds teased in the Linux 6.0 release note, were confirmed after he accepted the pull request made by Kees Cook, a Kernel security engineer at Google. This means that v6.1 will have direct support for the Rust code. Linux will not be entirely rewritten in Rust, but the process is already ongoing for adding 12,500 lines of code to the Linux kernel.

This is a major update given Linux kernel from the start (since 1991) has been written in C programming language. It is the same language that was used to write kernels for Unix and similar operating systems since the 1970s.

Most anticipated change

At the Linux Security Summit 2019, Alex Gaynor and Geoffrey Thomas (both distinguished software developers with substantial work with Rust) presented a talk where they made a case for Rust in the Kernel and even presented their work prototyping Rust kernel modules. They based their presentation on security concerns and how Rust can avoid such error classes through safer APIs.

Similar sentiments were echoed by many developers. According to a few reports, the thought of Rust in the Linux kernel first emerged as early as 2013.

Later, at the 2020 Linux Plumbers Conference that was held virtually, one of the most heavily attended sessions was the one where attendees discussed and debated using Rust upstream in the Linux kernel and also the challenges of doing so.

Torvalds seemed more open to the idea and even requested that Rust compiler availability be enabled by default in the kernel build environment. This would enable any potential submissions to be built and automatically tested like any other kernel code.

In the same year, Torvalds was speaking at the Open Source Summit. During the discussion, he spoke about a lot of topics, including the one concerning the future of Linux overall, considering the current crop of maintainers is in their forties, even fifties. He was also asked if C, the language in which the kernel is written, faces risk from Go, Rust and others. To this, Torvalds said that while C is still one of the top ten languages, the kernel team was looking into using Rust and the likes to write things that are “not very central to the kernel itself”. He further added, “It is going to happen that we will have different models for writing these kinds of things, and C won’t be the only one.”

From the beginning of this year, Torvalds started making bolder statements. In fact, at this year’s Open Source Summit in Texas, he said that Rust could make it to the Linux kernel by the next major release.

Why Rust is more preferred over others

There is a good reason why C is one of the most popular languages, even decades later. It is easy to read and write, and is portable between hardware architectures. That said, C has some glaring challenges, specifically due to its nature as a non memory-managed language. A variable, once its purpose is realised, must be explicitly destroyed. Failing to do so may give rise to memory leaks or even cause system crashes due to overaccumulation. 

On the other hand, Rust has emerged as a ‘developer darling’ of late. It has been long favoured as the desirable contender as a second language for kernel, especially due to its automated way of ensuring secure memory management. Rust has good support for interoperability with code written in C, including support for both calling functions using the C ABI and for defining functions with C-compatible ABIs. Further, the bindgen tool can parse C header files to give appropriate Rust declarations so that there is no need to duplicate definitions from C. This in turn provides a scope for cross-language type checking.

Last year, it was reported that the Google Android team was supporting a project led by developer Miguel Ojeda to write a few elements of the Linux kernel. During the development phase, Ojeda said that the team built a Rust Binder kernel module that demonstrated better preliminary performance than the C version. In a blog that details the Rust for Linux project, Ojeda wrote that one of the key properties of Rust that makes it very interesting to consider as the kernel second language is that it makes sure no ‘undefined behaviour’ occurs, especially in terms of memory management. “This includes no use-after-free issues, no double frees, no data races, etc,” he added.

Download our Mobile App

Shraddha Goled
I am a technology journalist with AIM. I write stories focused on the AI landscape in India and around the world with a special interest in analysing its long term impact on individuals and societies. Reach out to me at

Subscribe to our newsletter

Join our editors every weekday evening as they steer you through the most significant news of the day.
Your newsletter subscriptions are subject to AIM Privacy Policy and Terms and Conditions.

Our Recent Stories

Our Upcoming Events

3 Ways to Join our Community

Telegram group

Discover special offers, top stories, upcoming events, and more.

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Subscribe to our Daily newsletter

Get our daily awesome stories & videos in your inbox

6 IDEs Built for Rust

Rust IDEs aid efficient code development by offering features like code completion, syntax highlighting, linting, debugging tools, and code refactoring

Can OpenAI Save SoftBank? 

After a tumultuous investment spree with significant losses, will SoftBank’s plans to invest in OpenAI and other AI companies provide the boost it needs?

Oracle’s Grand Multicloud Gamble

“Cloud Should be Open,” says Larry at Oracle CloudWorld 2023, Las Vegas, recollecting his discussions with Microsoft chief Satya Nadella last week.