A post on Google’s security blog by Android engineers Ivan Lozano and Dominik Maier promises to show “how to gradually introduce Rust into your existing firmware,” adding “You’ll see how easy it is to boost security with drop-in Rust replacements, and we’ll even demonstrate how the Rust toolchain can handle specialized bare-metal targets.”
This prompts the Register to quip that easy “is not a term commonly heard with regard to a programming language known for its steep learning curve.”
Citing the lack of high-level security mechanisms in firmware, which is often written in memory-unsafe languages such as C or C++, Lozano and Maier argue that Rust provides a way to avoid the memory safety bugs like buffer overflows and use-after-free that account for the majority of significant vulnerabilities in large codebases. “Rust provides a memory-safe alternative to C and C++ with comparable performance and code size,” they note. “Additionally it supports interoperability with C with no overhead.”
At one point the blog post explains that “You can replace existing C functionality by writing a thin Rust shim that translates between an existing Rust API and the C API the codebase expects.” But their ultimate motivation is greater security. “Android’s use of safe-by-design principles drives our adoption of memory-safe languages like Rust, making exploitation of the OS increasingly difficult with every release.”
And the Register also got this quote from Lars Bergstrom, Google’s director of engineering for Android Programming Languages (and chair of the Rust Foundation’s board of directors). “At Google, we’re increasing Rust’s use across Android, Chromium, and more to reduce memory safety vulnerabilities. We’re dedicated to collaborating with the Rust ecosystem to drive its adoption and provide developers with the resources and training they need to succeed.
“This work on bringing Rust to embedded and firmware addresses another critical part of the stack.”
Read more of this story at Slashdot.