Fundamentals 6 min read

Why Rust is Making Its Way into the Linux Kernel: Insights from Linus and Greg

The article examines how Rust is entering the Linux ecosystem, detailing discussions between Linus Torvalds and Greg Kroah‑Hartman, the motivations for using Rust in kernel development, and the potential impact on safety and driver programming.

21CTO
21CTO
21CTO
Why Rust is Making Its Way into the Linux Kernel: Insights from Linus and Greg

It is now clear that Rust is entering the Linux ecosystem, with kernel developers Linus Torvalds and Greg Kroah‑Hartman discussing how Rust and Linux can work together.

Linux has long been synonymous with the C language, but the tide is turning as Rust emerges as a possible supported language for the system.

At the 2020 Linux Plumbers conference, kernel developers and the Rust team debated using Rust for new internal Linux code.

Since September 2019, maintainer Greg Kroah‑Hartman expressed willingness to accept Rust for Linux driver development, and in July 2020 Linus Torvalds replied that Rust support could be enabled by default.

Today, many Linux‑based projects already incorporate Rust. For example, AWS’s Bottlerocket Linux for containers contains a substantial amount of Rust code.

Sylvestre Ledru, a Mozilla manager by day and Debian Linux developer by night, has ported the Rust‑based coreutils to Linux; coreutils are the essential GNU shell utilities.

Rust’s popularity stems from its ability to write safer software. It enforces thread safety and prevents memory‑corruption errors, reducing buffer‑overflow vulnerabilities and allowing developers to provide safer APIs.

Data shows that roughly two‑thirds of Linux kernel vulnerabilities stem from memory‑related issues.

Linux kernel developer Nelson Elhage clarified at the Plumbers conference that while Linux is beginning to support Rust, there is no proposal to rewrite the kernel in Rust; the focus is on exploring new code possibilities. Rust support targets three areas: leveraging existing kernel APIs, providing architecture support, and handling ABI compatibility between Rust and C.

Linus Torvalds, who had been “watching and waiting,” expressed strong interest, noting that the project is driven by enthusiastic Rust supporters and he looks forward to seeing its practical impact.

Torvalds believes Rust’s primary target will be drivers, as kernel components are small and independent, which may not be the most exciting goal but is a practical entry point.

Kroah‑Hartman agrees that drivers are likely the first step, as they sit at the leaf nodes of the kernel source dependency tree, depending on kernel functionality without the kernel depending on them.

Torvalds also acknowledges that some people dislike placing Rust in user space; the kernel and user‑space projects differ, and Rust can extend C’s boundaries while keeping the kernel relatively independent.

Kroah‑Hartman added that mapping C’s kernel architecture and lifecycle rules to Rust’s structures and lifetimes will require careful, detailed work from developers.

Porting C code to Rust within Linux will take time, encompassing user‑space programs, drivers, and the Rust‑based kernel itself.

This move is expected to spark further interest in using Rust for system‑level development.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

RustLinux kernelMemory Safetykernel-developmentSystems Programming
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.