The first big change for the upcoming Linux 6.1 kernel is here… and it’s a big one.
Kees Cook made the pull request and Linus Torvalds accepted it earlier this week, meaning Linux 6.1 will soon have direct support for Rust code. Initial support is in the range of 12.5k lines of code.
No, this does not mean rewriting the kernel in Rust. There are already other Rust operating system kernels in development, such as Redox OS, and Linux will not be one of them.
Linux is a traditional monolithic Unix kernel that follows closely in the footsteps of the original AT&T kernel of the 1970s, and if rewritten in a different programming language it would cause serious difficulties in interoperating with existing code.
What’s interesting is that it’s Rust who made it. There are several languages vying to succeed C, with C-like syntax but adding new features to C. C++ was one of the first to add object-oriented programming to C.
Many Unix and Linux traditionalists disapprove of C++, but it has enjoyed great success despite its great size and complexity. KDE, the Plasma desktop, and the many apps in the KDE Gear collection are mostly built in C++, which has aided their adaptation to the security-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 KDE’s most widely used code.
C++ has also been used in several successful operating system projects: Psion’s EPOC32, which evolved into the Symbian smartphone operating system, as well as BeOS and Haiku.
However, C++ is notorious for its size and complexity, which has inspired several successors attempting to leverage some of its power, such as . B. OOPS support, while being easier to maintain. Apple’s Objective-C replaces C++’s OOPS style inherited from Simula with Smalltalk-style OOPS. Google’s Go is related to Plan 9 OS’s Alef and Limbo, the systems programming language of Inferno, the last descendant of the original UNIX project. The D-language was developed by Walter Bright, who wrote Zortech C++ (later sold as Symantec C++), the first-ever compiler to turn C++ source code into native object code.
All have improved C in various ways, but none have received the approval of the kernel team. In fact, writing about Rust is always quick to garner enthusiastic supporters like none of the others does – and no doubt this story will, too. That was the case when we previously wrote about the expected support mentioned in Torvald’s Open Source Summit keynote. Anything other than passionate support for Rust or any kind of criticism is usually met with severe criticism.
Previously, Rust advocates have told us that interoperability with C code is one of its core strengths. However, the latest version of Rust still doesn’t compile with GCC, and the Clang compiler that supports Rust only has premium support for x86-64 and AArch64.
So this could be a limiting factor for now: if a driver is implemented in Rust, it could mean limited support of the corresponding hardware (or filesystem or whatever) for other processor architectures. However, a likely consequence of this will be a rapid improvement in Rust’s compiler support – both in other compilers and most likely in Clang and LLVM target support. ®
https://www.theregister.com/2022/10/05/rust_kernel_pull_request_pulled/ Rust meets mainline kernel • The Register