قالب وردپرس درنا توس
Home / Technology / Google is now writing low-level Android code in Rust

Google is now writing low-level Android code in Rust



A heart distinguishes an Android logo from a Rust logo.

Just last month, we saw the first baby steps towards the adoption of the memory-driven Rust programming language in the Linux kernel. Google has apparently been thinking in the same direction, and in a lengthy blog post on Tuesday, the company announced that the Android Open Source Project now supports Rust for low-level OS components.

The Android team is doing a lot of work to push Kotlin and Java for app developers, but these languages ​​rely on Android Runtime (ART) to work. You can not write anything lower than ART in Java, as there will be no runtime environment to run it on. In the past, Google has typically used C or C ++, but none of these are memory-driven languages, and it opens up Android for memory leaks and buffer overflows.

Google adds the benefits of Rust over C / C ++ and states: “Rust provides memory security guarantees by using a combination of compilation time controls to enforce object life / ownership and runtime controls to ensure memory access is valid. This security is achieved while providing similar performance to C and C ++. “In line with similar statistics published by Microsoft, Google̵

7;s blog post states that” memory security bugs continue to be a major contributor to stability issues, consistently representing ~ 70% of Android’s high severity issues. “

Google's (strangely blurry?) Android memory error chart.  The old code has already fixed most of the errors.
Enlarge / Google’s (strangely blurry?) Android memory error chart. The old code has already fixed most of the errors.

Google

Google says that rewriting “tens of millions of lines” of existing C and C ++ Android code in Rust is “simply not possible”, and rewriting old Android would have no bearing since old code has received the most the bugs knocked out of it now. Since the Android source code is an open source project with billions of users, there are many eyeballs to it. Google says that “most of our memory bugs appear in new or recently modified code, with about 50% less than a year old.” Rust will be used for new components when needed, which may help reduce any new memory errors Google may introduce.

Google closes the blog post, saying: “Over the last 18 months, we’ve added Rust support to the Android Open Source Project, and we have some early adoption projects that we’ll be sharing in the coming months. is a multi-year project. Stay tuned, we will post more updates on this blog. “


Source link