The Linux Kernel Bids Farewell to Binder in C: Rust Wins

Translated by a model; the original is in Russian.

· Linux and open source
The Linux 7.4 kernel is set to remove the old C implementation of Binder. The Rust version will become the sole option for inter-process communication on Android.

cover.svg

The Binder driver — the inter-process communication (IPC) mechanism at the heart of Android — has for years lived in the mainline Linux kernel as C code. In the upcoming Linux 7.4 development cycle, this historic implementation is slated to be retired for good.

Over the past few years Binder has been rewritten in Rust — one of the first "real" drivers in the kernel written in that language. The Rust version was merged into the mainline in Linux 6.18, and now that it has matured enough and proven its worth, the time has come to send the old C code, roughly 11 thousand lines, into retirement.

"Painful to maintain"

The removal patch was prepared by Google engineer Carlos Llamas, and his cover letter strikes an almost ceremonial tone. "This day has finally come," he writes. According to Llamas, over more than 15 years the C driver had accumulated so much complexity that maintaining it and adding new features became painfully hard: nearly every change threatened to introduce new vulnerabilities. The Rust implementation, in his estimation, eliminates most of these problems.

The engineer extended special thanks to Alice Ryhl, who spent a couple of years working on Binder in Rust. She managed not only to achieve full feature parity but also to show that the new driver can match the old one in performance, and often surpass it. The Rust version has been running smoothly on real Android devices for some time now, so it can no longer be called an "experiment."

"It's time to move on, tear out the C code by the roots, and focus all new features and optimizations on the Rust driver. Long live the new Rust king of Binder!" Llamas concludes his message.

Already in the queue

The removal patch was picked up by Greg Kroah-Hartman, who sent it into the char-misc-next branch. This means the change will be submitted in the Linux 7.4 merge window. And so the story of the dual coexistence of the C and Rust versions of Binder is drawing to a close, while the case itself becomes a vivid argument for advocates of Rust's gradual penetration into the kernel: the language has not only taken root but has also displaced time-tested C where it had become a burden.


Source: Phoronix

Comments

Sign in, to comment.

  • No comments yet.