Linux Format

Rust testing the kernel

LLVM is ready to check your distro.

-

The release of Linux Kernel 6.1 introduced a significan­t change: support for a second language, Rust. This offers developers intriguing options. There are 30 million lines of code in the kernel, so it’ll be many years before Rust becomes a significan­t part of it. For now, all we have is some sample modules and subsystem-specific bindings. There aren’t any real device drivers yet, but the basic infrastruc­ture has been laid down. At the last Linux Maintainer­s Summit, Linus Torvalds asked for this new infrastruc­ture to be tested, and it has now been added to the KernelCI (the communityb­ased testing project that makes sure Linux passes muster). There’s a simple command to check a distro has the required dependenci­es, which returns the curt but friendly message “rust is available!” if they are. Currently, only version 1.62 of the LLVM-based Rustc compiler is supported, so there’s some work to do yet. (LLVM is a set of low-level complier tools that help develop front and back-ends for any instructio­n set architectu­re; it’s language independen­t.) The GCC Rust front-end is currently being worked on, but for now, if you want Rust in your kernel, you need to use LLVM.

It is still very early days for Rust and Linux, but the plan is that the capability to do any required testing will keep pace, which is why basic testing has been put in place before the kernel supporting it was even released (by six days, anyway). The next step is kunit tests, more toolchain and Kconfig combinatio­ns. However enthusiast­ic the uptake for developing the kernel using Rust proves to be, it’ll be a while before wide-scale testing of drivers and other components written in Rust is required. When Mr Torvalds asks for help with the kernel, it seems things get done pretty quickly.

 ?? ?? Linux is no longer the home of pure C. If you go with Rust, kernel testing is in place, albeit in a limited form for now.
Linux is no longer the home of pure C. If you go with Rust, kernel testing is in place, albeit in a limited form for now.

Newspapers in English

Newspapers from Australia