Linus Torvalds is optimistic about bringing Rust into the Linux kernel
For over three decades, Linux has been written in the C programming language. In fact, Linux is the most outstanding achievement of C. But it is also thanks to the rigor of Linus Torvalds and the maintainers in general that we have managed to obtain a result of this genre. But the past few years have seen increasing momentum to make the Rust programming language the second language of Linux .
At the recent Open Source Summit in Austin, Texas, Linux creator Linus Torvalds was in favor of seeing Rust part of the Linux kernel with the next major release . Currently, Torvalds and the maintainers are working on 5.19, which is expected to be released during the month of August 2022. Therefore, we will likely see Rust in the next version, the 5.20, which should arrive between late October and early November 2022, taking into account the timing. mainline kernel release media:
“I'd like to see the Rust infrastructure merger get started in the next version, but we'll see. But I won't force him. "
Why does he go so far towards using Rust in the Linux kernel?
Rust lends itself more easily to writing secure software . Samartha Chandrashekar, an Amazon AWS product manager, said it "helps ensure thread safety and prevent memory-related errors such as buffer overflows that can lead to security vulnerabilities."
Rust guarantees the safety of the memory in the compilation phase by using controls integrated in the compiler . The compiler therefore does not allow non-memory safe code, unless it is explicitly marked as unsafe in an insecure block or function. This static compile-time analysis eliminates many types of memory bugs, and with some additional runtime checks, Rust ensures memory safety.
Mind you, no one is going to rewrite the entire 30 million lines of the Linux kernel in Rust . In fact, the idea is to gradually move towards Rust. In particular, we plan to start testing coding in Rust for more high-level components such as drivers . At present, the three areas of potential concern for Rust support are using existing APIs in the kernel, architecture support, and managing application binary interface (ABI) compatibility between Rust and C.
Of course, by definition, the kernel will have to do "non-standard" operations in memory. So how do you use Rust, which among its features includes the inability to do non-memory-safe operations, in the kernel? Fortunately, Rust allows you to disable these checks, which is necessary for developing kernel-level code.
A little history of Rust
Rust is a compiled, multi-paradigm, general-purpose programming language developed by Mozilla Research, in collaboration with the open-source community. It aims to be an efficient, secure, and suitable language for developing competing software. It is designed to support imperative-procedural, functional, and object-oriented programming paradigms.
The language emerged from a personal project by Mozilla employee Graydon Hoare. Mozilla's support for the project began in 2009 and was announced in 2010. The same year, the compiler itself, initially written in OCaml, began to be rewritten in Rust. This compiler, known as rustc, managed to compile itself in 2011. As a back end it uses the open source framework LLVM.
The first release of the Rust compiler took place in January 2012. The release of 1.0, the first stable version, took place on May 15, 2015. Although its development is supported by Mozilla, it is a project open to the open community. source that actively contributes. The design of the language was refined by the experience of using it in the development of the Servo web browser engine and the rustc compiler.
In a 2016 survey of Stack Overflow developers, Rust ranked # 1 as “Most Loved Programming Language”. The position was also confirmed in the polls of 2017, 2018, 2019, 2020 and 2021.
The article Linus Torvalds is optimistic about bringing Rust into the Linux kernel was written at: Tech CuE | Close-up Engineering .