Rust For Linux
   HOME

TheInfoList



OR:

Rust for Linux is an ongoing project started in 2020 to add
Rust Rust is an iron oxide, a usually reddish-brown oxide formed by the reaction of iron and oxygen in the catalytic presence of water or air moisture. Rust consists of hydrous iron(III) oxides (Fe2O3·nH2O) and iron(III) oxide-hydroxide (FeO(OH) ...
as a
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
that can be used within the
Linux kernel The Linux kernel is a Free and open-source software, free and open source Unix-like kernel (operating system), kernel that is used in many computer systems worldwide. The kernel was created by Linus Torvalds in 1991 and was soon adopted as the k ...
software, which has been written using C and assembly only. This project aims to leverage Rust's memory safety to reduce bugs when writing
kernel driver In the context of an operating system, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer or automaton. A driver provides a software interface to hardware devices, enabli ...
s. Progress has been slower than hoped by both Rust advocates and
Linus Torvalds Linus Benedict Torvalds ( , ; born 28 December 1969) is a Finnish software engineer who is the creator and lead developer of the Linux kernel. He also created the distributed version control system Git. He was honored, along with Shinya Yam ...
, lead of the Linux kernel project. In December 2023, the first drivers written in Rust were accepted, and released in version 6.8.


History

The Linux kernel has been primarily written in C and assembly languages since its first release in 1991. Around 1997, the addition of C++ was considered and experimented upon for two weeks before being scrapped. Rust was created in 2006 and combines the performance of
low-level programming language A low-level programming language is a programming language that provides little or no Abstraction (computer science), abstraction from a computer's instruction set architecture, memory or underlying physical hardware; commands or functions in the ...
s (such as C) with a focus on
memory safety Memory safety is the state of being protected from various software bugs and security vulnerabilities when dealing with memory access, such as buffer overflows and dangling pointers. For example, Java is said to be memory-safe because its ru ...
and a
user-friendly Usability can be described as the capacity of a system to provide a condition for its users to perform the tasks safely, effectively, and efficiently while enjoying the experience. In software engineering, usability is the degree to which a softw ...
tool set and
syntax In linguistics, syntax ( ) is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure (constituenc ...
. An example Linux external
loadable kernel module A loadable kernel module (LKM) is an executable library that extends the capabilities of a running kernel, or so-called ''base kernel'', of an operating system. LKMs are typically used to add support for new hardware (as device drivers) and/or ...
created using the Rust language was published by Taesoo Kim in 2013. The Rust for Linux project was announced in 2020 in the
Linux kernel mailing list The Linux kernel mailing list (LKML) is the main electronic mailing list for Linux kernel development, where the majority of the announcements, discussions, debates, and flame wars over the kernel take place. Many other mailing lists exist to d ...
with goal of adding Rust as a programming language that could be used within the Linux project. At the Open Source Summit 2022,
Linus Torvalds Linus Benedict Torvalds ( , ; born 28 December 1969) is a Finnish software engineer who is the creator and lead developer of the Linux kernel. He also created the distributed version control system Git. He was honored, along with Shinya Yam ...
stated that the incorporation of the project's work could begin as soon as the Linux 5.20 release, later named as Linux 6.0. The first release candidate for Linux 6.0 was created on 14 August 2022, without Rust support. In the release notes for Linux 6.0-rc1, Torvalds expressed his intention for adding Rust support, "I actually was hoping that we'd get some of the first rust infrastructure, and the multi-gen LRU VM, but neither of them happened this time around." On 19 September 2022, an article from ZDNet revealed an email from Linus Torvalds stating that "Unless something odd happens, it ustwill make it into 6.1". In October 2022, a
pull request In software development, distributed version control (also known as distributed revision control) is a form of version control in which the complete codebase, including its full history, is mirrored on every developer's computer. Compared to centr ...
for accepting the implementation for Rust for Linux was approved by Torvalds. As of Linux 6.1, support was intentionally left minimal in order to allow developers to test the feature. Rust for Linux developers created a new library "pinned-init" to safely and fallibly initialize memory that must not be relocated. It was first included in Linux 6.4, and been improved in later versions. Linux 6.10 included RISCV processor architecture support for Rust. In July 2024 a change was accepted into Linux to support multiple Rust versions for the first time, allowing compiling using both 1.78 (Released 2 May, 2024) and 1.79 (Released 13 June, 2024). , Rust for Linux depends on unstable features of the Rust compiler.


Usage

Linux kernel contains the following Rust components: * rnull, a drop-in replacement for the
null device In some operating systems, the null device is a device file that discards all data written to it but reports that the write operation succeeded. This device is called /dev/null on Unix and Unix-like systems, NUL: (see TOPS-20) or NUL on CP/M a ...
* ASIX AX88772A and
Realtek Realtek Semiconductor Corp. () is a Taiwanese fabless semiconductor company situated in the Hsinchu Science Park, Hsinchu, Taiwan. Realtek was founded in October 1987 and subsequently listed on the Taiwan Stock Exchange in 1998. Realtek has manu ...
Generic FE-GE
physical layer In the seven-layer OSI model of computer networking, the physical layer or layer 1 is the first and lowest layer: the layer most closely associated with the physical connection between devices. The physical layer provides an electrical, mechani ...
network drivers * QR code DRM panic handler Other notable projects using Rust in Linux include: * tarfs, a
tar Tar is a dark brown or black viscous liquid of hydrocarbons and free carbon, obtained from a wide variety of organic materials through destructive distillation. Tar can be produced from coal, wood, petroleum, or peat. "a dark brown or black b ...
filesystem *
NVM Express NVM Express (NVMe) or Non-Volatile Memory Host Controller Interface Specification (NVMHCIS) is an open, logical-device interface functional specification, specification for accessing a computer's non-volatile storage media usually attached via th ...
(NVMe) device driver * Android Binder
IPC IPC may refer to: Businesses and organizations Arts and media * Intellectual Property Committee, a coalition of US corporations with intellectual property interests * International Panorama Council, an international network of specialists in ...
driver *
Asahi Linux Asahi Linux is a project that Porting, ports the Linux kernel and related software to Apple Silicon-powered Mac (computer), Macs, started by Hector Martin (hacker), Hector Martin. It does so by Reverse engineering, reverse-engineering the System ...
's
Apple silicon Apple silicon is a series of system on a chip (SoC) and system in a package (SiP) processors designed by Apple Inc., mainly using the ARM architecture family, ARM architecture. They are used in nearly all of the company's devices including Mac ...
AGX GPU DRM driver * PuzzleFS, a
container A container is any receptacle or enclosure for holding a product used in storage, packaging, and transportation, including shipping. Things kept inside of a container are protected on several sides by being inside of its structure. The term ...
filesystem * Read-only
ext2 ext2, or second extended file system, is a file system for the Linux kernel (operating system), kernel. It was initially designed by French software developer Rémy Card as a replacement for the extended file system (ext). Having been designed ...
filesystem * Nova, intended to create a Rust
nouveau A ''nouveau'' ( ), or ''vin (de) primeur'', is a wine which may be sold in the same year in which it was harvested. The most widely exported ''nouveau'' wine is French wine Beaujolais ''nouveau'' which is released on the third Thursday of ...
Nvidia GPU driver, is being developed on the
freedesktop.org freedesktop.org (fd.o), formerly X Desktop Group (XDG), is a project to work on interoperability and shared base technology for free-software desktop environments for the X Window System (X11) and Wayland on Linux and other Unix-like operatin ...
project infrastructure


See also

*
LynxOS The LynxOS RTOS is a Unix-like real-time operating system from Lynx Software Technologies (formerly "LynuxWorks"). Sometimes known as the Lynx Operating System, LynxOS features full POSIX conformance and, more recently, Linux compatibility. L ...
* Redox OS


References

{{Linux, state=collapsed Free software programmed in Rust Linux software projects