X
Business

Programming languages: Now Rust project looks for a way into the Linux kernel

The Rust programming language gets a nod of approval from Linux creator Linus Torvalds.
Written by Liam Tung, Contributing Writer

The makers of systems programming language Rust are looking at how to adapt the language for use in the Linux kernel. 

Josh Triplett, a former Intel engineer and a lead of the Rust language team, says he'd "love to see a path to incorporating Rust into the kernel", as long as it's done cautiously and doesn't upset Linux kernel creator Linus Torvalds. 

"If building Rustic interfaces within the kernel requires some additional language features, we should see what enhancements to the language would best serve those requirements," he said in a mailing list discussion about a proposed Linux Plumbers Conference session on support for Rust in the Linux kernel tree.

SEE: Hiring Kit: Python developer (TechRepublic Premium)

"I've often seen the sentiment that co-evolving Linux and a C compiler would be beneficial for both; I think the same would be true of Linux and the Rust compiler," Triplett added.   

The Rust session was proposed by Google engineer Nick Desaulniers, who works on compiling the Linux kernel with Clang and LLVM.

Triplett is an advocate of using Rust for systems-level programming and as a replacement for C, which has been widely used at Microsoft for Windows and within the Linux kernel. Microsoft sees value in Rust for eradicating memory-related security flaws in parts of Windows written in C and C++.  

As The Register reported in June, Torvalds said the Linux kernel team is looking at having Rust interfaces for things like drivers that aren't central to the kernel. 

"I'm convinced it's going to happen. It might not be Rust. But 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," said Torvalds. 

In an exchange with Triplett on Friday, Torvalds made it clear he wants Rust to be kept in check for now, until the first Rust driver for the Linux kernel becomes available and the kernel team has had time to test it. 

"Please make it a 'is Rust available' automatic config option," Torvalds told Triplett. "The exact same way we already do the compiler versions and check for various availability of compiler flags at config time."

SEE: Programming language rankings: R makes a comeback but there's debate about its rise

"I _don't_ want us to be in the situation where any new Rust support isn't even build-tested by default. Quite the reverse. I'd want the first Rust driver (or whatever) to be introduced in such a simple format that failures will be obvious and simple.

"The _worst_ situation to be in is that a (small) group of people start testing their very special situation, and do bad and crazy things because 'nobody else cares, it's hidden'."

Torvalds' warning probably comes as no surprise to Triplett and could explain Triplett's cautious but eager approach to rolling out Rust support in the Linux kernel. His goals include: 

  • Creating appropriate Rustic interfaces that are natural and safe to use – not just C FFI, and not just trivial transformations like   slices instead of buffer+len pairs. 
  • Ensuring those Rustic interfaces are easy to maintain and evolve with the kernel.
  • Providing compelling use cases that go beyond just basic safety, such as concurrency checking, or lifetimes for object ownership. 
  • Making Rust fit naturally into the kernel's norms and standards, while also introducing some of Rust's norms and standards where they make sense. "We want to fit into the kernel, and at the same time, we don't want to hastily saw off all the corners that don't immediately fit, because some of those corners provide value. Let's take our time," Triplett wrote. 
  • Moving slowly and carefully, making sure it's a gradual introduction, and giving people time to incorporate the Rust toolchain into their kernel workflows.

Update: The story has been updated to make clear that Triplett is a former Intel engineer and a lead on the Rust language team.


More on programming languages and Rust

  • Programming languages: Rust enters top 20 popularity rankings for the first time  
  • Microsoft: Here's why we love programming language Rust and kicked off Project Verona  
  • Programming languages: Developers reveal what they love and loathe, and what pays best  
  • Programming language Rust: 5 years on from v1.0, here's the good and the bad news
  • Microsoft: Here's how we're killing a class of memory security bugs in Windows 10  
  • Programming language Rust's adoption problem: Developers reveal why more aren't using it  
  • Google programming language scorecard: How C, C++, Dart, Rust, Go rate for Fuchsia
  • Developers love Rust programming language: Here's why
  • Microsoft: We're creating a new Rust-like programming language for secure coding
  • Programming languages: Kotlin rises fastest but JavaScript lures millions more developers
  • Microsoft opens up Rust-inspired Project Verona programming language on GitHub
  • Brave defies Google's moves to cripple ad-blocking with new 69x faster Rust engine
  • How to install Rust on Linux TechRepublic 
  • Editorial standards