4 projects ripe for a Rust rewrite

As Rust matures, projects aimed at reimplementing existing software in a language built for safety become more practical -- and more numerous

Mozilla's Rust language has all the hallmarks of a winning software project. It has a quickly evolving toolchaina supportive community, and an expanding roster of libraries. But above all, it has a mission: To provide the world with a safer, better-considered alternative to C and C++ for application- and system-level programming -- and to proactively prevent the next generation of software security disasters from happening.

We're now seeing the first projects take the Rust plunge -- not only to benefit from the language's safety features, but for easier cross-platform porting of projects and to stimulate Rust's development.

Mozilla Firefox/Servo

One of the first major projects associated with Rust aimed to create an HTML rendering engine -- Servo -- that would eventually replace Mozilla's rendering engine. Longer-term plans include making "a standalone Servo browser or embeddable library (e.g., for Android)."

We're still a long way from a fully Rust-powered Firefox, but it seems to be in the cards.

GNU Coreutils

The GNU Coreutils command-line tools, created by the GNU project and found most commonly in Linux distributions, have been written mainly in C. This project seeks to aggregate them into a single GitHub-hosted repository and port them to Rust.

The latter move isn't merely about taking advantage of Rust's safety features -- which seems vital given how many command-line Linux utilities are under-audited and at risk of being security hazards. It's also about taking advantage of the benefits of cross-platform portability. Rust provides "a good, platform-agnostic way of writing systems utils that are easy to compile anywhere," the project's documentation states.

The Tor project

According to a ticket opened on the bug-tracking system for the Tor peer-to-peer anonymous Web-browsing service, there's interest in incrementally rewriting the project in Rust to make it "simpler, better, bug-free." (Bug-free might be wishful thinking; bug-resistant is more like it.)

Rather than rewrite the project from scratch, the project is exploring the idea of rewriting the individual components that are most at risk, since Rust code interfaces readily with C. For inspiration, Tor's maintainers are looking to the Servo project for inspiration on how to mix Rust and C in the build process.

Linux kernel modules

Rewriting the entire Linux kernel in Rust would be a colossal undertaking, given how many millions of lines of code it contains. A more modest approach (and one that might have more immediate benefit) would be to rewrite individual kernel modules in Rust -- again, by leveraging Rust's ability to interface with C. Taesoo Kim of MIT provides an example project on GitHub for how to do this.

Projects like this are not only useful for incrementally securing Linux, but also to improve Rust's interfaces with C. Macro definitions in C, for instance, can't currently be used by Rust's toolchain.

If Rust is going to interoperate more closely with C, as a prelude to replacing it in some cases, it makes sense for Rust to interoperate more deeply with the C toolchain. That project will likely be as ambitious as anything already happening with Rust.

Copyright © 2016 IDG Communications, Inc.