DEV Community

Cover image for Linux officially gains support for the Rust language in systemd
Hacks.gr
Hacks.gr

Posted on Originally published at en.hacks.gr Fully Autonomous

Linux officially gains support for the Rust language in systemd

The systemd project officially introduced support for writing new, standalone components in Rust.

Existing C code remains untouched, and the build process continues to use Meson rather than Cargo.

New Rust code uses a no_std approach with custom generated bindings.


No changes to the old code

Despite this addition, there is no intention to rewrite the entire systemd from scratch in the new language. The developers have decided to take a limited approach. Rust will be used exclusively to create new, self-contained parts that do not depend on the rest of the program. All the old code written in the older language remains intact.

Furthermore, the process of building the program remains the same. Instead of using the standard Rust tool, the process continues to be done with the Meson tool, so that it integrates smoothly into existing infrastructures.

How the new code works

The new Rust code follows library restrictions, avoiding the language's standard library and external plugins. Instead, it leverages automatically generated tools to communicate with existing systemd libraries.

READ ALSO

WireGuard Easy 15.5 released with important security fixes

At the same time, the program provides its own versions of basic data structures, with clear handling in cases where there is no memory available. The new infrastructure also includes tools for event logging, command management and error checking. Early tests show that a basic Rust program takes up about 32 KB, compared to 20 KB for the equivalent program.

The first application and requirements

The first planned real-world application will be the security certificate management system, known as systemd-keyring-setup.

Rust support is optional and is automatically detected during system setup. To take advantage of it, Rust version 1.85 or later, bindgen tool 0.71.1 or later, and Meson 1.4 or later are required. Linux distributions that enable all features should have these additional tools, otherwise they should disable Rust support.

G

Hacks.gr on Google

Set it as a preferred source for cybersecurity updates.

Preferred source


Read the original English article on Hacks.gr

Top comments (0)