Home / Technology / Google is writing low-level Android code in Rust.

Google is writing low-level Android code in Rust.

The heart separates the Android logo from the Rust logo.

Last month we saw a first step in bringing the memory-managed Rust programming language into the Linux kernel, it looks like Google is thinking the same way, and in a blog post with the Long last Tuesday, the company announced that the Android Open Source Project now supports Rust for low-end operating system components.

The Android team did a lot of work pushing Kotlin and Java for app developers. But those languages ​​require Android Runtime (ART) to run. You can̵

7;t write anything lower than ART in Java, as there won’t be a runtime environment to run in the past.Google often used C or C ++, but neither of them are memory-managed languages ​​and thus Android has a unit. Memory leaks and buffer overflow.

Google explains the benefits of Rust over C / C ++, saying, “Rust provides a guarantee of memory security by using a combination of compile-time checks to enforce lifetime / life checks. The owner and the runtime of the object to ensure proper memory access. While delivering performance comparable to C and C ++, “according to a similar statistic published by Microsoft, a Google blog post said,” memory security flaws remain a top-notch factor in the security problem of the device. ” Stability and represents approximately 70% of Android’s high-severity vulnerabilities. “

Google's (weird blur) memory bug chart on Android. Old code has almost completely fixed bugs.
Expand / Google’s (weird blur) memory bug chart in Android, the old code has mostly been fixed bugs.


Google says that rewriting “tens of millions of lines” of existing C and C ++ Android code in Rust is “impossible” and rewriting old Android will not matter as much as the old code is largely flawed. That was attacked by now. Since Android source code is an open source project with billions of users, it has a lot of eyes on it. Google says, “Most of the memory bugs happen in new or recently modified code. Approximately 50% are less than a year old. Rust is used for new components when needed, eliminating any new memory flaws that Google can suggest.

Google closed a blog post stating, “Over the past 18 months, we’ve added Rust support to the Android open source project, and we have early user projects that we’ll share in a bit more. In the coming months, OS is a multi-year project, please be patient, we will post more updates on this blog. “

Source link