In efforts to improve the detection of memory safety bugs, Google announces support for Rust code in the development of the Android OS.
The problem is that C, C++, and Assembly languages don’t provide safety guarantees. This directly affects the correctness of code in the Android platform, which in turn is a top priority for the security, stability, and quality of each Android release.
Memory safety bugs in C and C++ can be costly in that there is a great deal of effort and resources put into detecting, fixing, and mitigating this class of bugs. Memory safety bugs continue to be a top contributor of stability issues, and consistently represent about 70% of Android’s high severity security vulnerabilities.
Android already supports memory-safe languages like Java and Kotlin. These languages are used for app development. For low-level tasks, engineers would need low-level programming languages like C, C++, and Rust.
Rust code provides memory safety guarantees by using a combination of compile-time checks to enforce object lifetime/ownership and runtime checks to ensure that memory accesses are valid. This safety is achieved while providing equivalent performance to C and C++.
It is important to note that introducing Rust programming language does not address bugs in existing C/C++ code. Replacing all the C and C++ code would be a monumental task. It would be more feasible to implement newer code in Rust over several years.
In addition, there are toolchains and dependencies that need to be maintained, test infrastructure and tooling that must be updated, and developers that need to be trained.
“For the past 18 months we have been adding Rust support to the Android Open Source Project, and we have a few early adopter projects that we will be sharing in the coming months.” Android Team.
Read the full announcement here about the Rust code support from the official Google Security Blog.
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.