This article is more than 1 year old
Linux 6.1: Rust to hit mainline kernel
New language will be official, probably within a couple of months
The first big change for the forthcoming Linux kernel 6.1 is in… and it's a big one.
Kees Cook made the pull request and Linus Torvalds accepted it earlier this week, meaning that Linux 6.1 will soon have direct support for Rust code, as teased earlier this week. The initial support is in the region of 12-and-a-half thousand lines of code.
No, this doesn't mean that the kernel will start to be rewritten in Rust. There are already other Rust operating system kernels in development, such as Redox OS, and Linux is not, practically speaking, going to become one of them.
What's interesting is that it's Rust that has made it. There are multiple languages vying to be successors to C, with C-like syntax but which extend C with new features. C++ was one of the first, which adds object oriented programming to C.
Many Unix and Linux traditionalists frown upon C++, but it's enjoyed wide success despite its great size and complexity. KDE, the Plasma desktop, and the many apps in the KDE Gear collection are predominantly built in C++, which has aided their adaptation to the safety-enhanced CHERI processor architecture. The Blink engine behind the Chrome browser is based on Apple's WebKit engine, which in turn is based on KDE's KHTML, making it by far the most widely used code from KDE.
C++ has also been used in multiple successful OS projects: Psion's EPOC32, which evolved into the Symbian smartphone OS, as well as BeOS and Haiku.
C++, however, is famed for its size and complexity, which has inspired multiple successors which try to retain some of its power, such as OOPS support, while being simpler. Apple's Objective-C replaces C++'s OOPS style, inherited from Simula, with Smalltalk-style OOPS. Google's Go is related to Alef, from the Plan 9 OS, and Limbo, the systems programming language of Inferno, the last descendant of the original UNIX project. The D Language was created by Walter Bright, who wrote Zortech C++ (later sold as Symantec C++), the first ever compiler to turn C++ source into native object code.
- Linux kernel 6.0 debuts, Linus Torvalds teases 'core new things' coming in version 6.1
- The open internet repels its most insidious attackers. They'll return
- Is it time to retire C and C++ for Rust in new programs?
- Rust is eating into our systems, and it's a good thing
All improved upon C in various ways, but none has won the approval of the kernel team. Indeed, writing about Rust always quickly summons fervent supporters in a way that none of the others do – and doubtless this story will, too. It did when we previously wrote about the expected support that was mentioned in Torvalds' Open Source Summit keynote. Anything less than passionate support for Rust, or any kind of criticism, is typically met with savage criticism.
Previously, Rust advocates have told us that its interoperability with C code is one of its core strengths. However, the latest version of Rust still can't be compiled with GCC, and the Clang compiler that does support Rust only has first-class support for x86-64 and AArch64.
So, for now, this could be a limiting factor: if a driver is implemented in Rust, that could spell limited support for the relevant hardware (or filesystem or whatever) for other processor architectures. Saying that, though, a likely consequence will be rapid improvement in Rust's compiler support – both in other compilers, and quite likely in Clang and LLVM's target support too. ®