Home https://server7.kproxy.com/servlet/redirect.srv/sruj/smyrwpoii/p2/ Technology https://server7.kproxy.com/servlet/redirect.srv/sruj/smyrwpoii/p2/ 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 toward 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 Tuesday, the company announced that the Android Open Source Project now supports Rust for low-level OS components.

The Android team does a lot of work pushing Kotlin and Java into app developers, but those languages ​​rely on Android Runtime (ART) to work. You can not write any lower level than ART in Java, as there is no runtime environment to run it on. In the past, Google typically used C or C ++, but none of these are memory-driven languages, and this opens up Android for memory leakage and buffer overflow.

Google describes the benefits of Rust over C / C ++ and states: “Rust provides memory security guarantees by using a combination of compilation time control to enforce the object̵

7;s lifetime / ownership and runtime control to ensure that memory access is valid. This security is achieved while performing similarly to C and C ++. “In line with similar statistics released by Microsoft, Google’s blog post states that” memory security errors remain one of the biggest contributors to stability issues and consistently represent ~ 70% of Androids security vulnerabilities of high severity. “

Google's (strangely blurred?) Chart of memory errors in Android.  The old code has already had most of the errors fixed.
Enlarge / Google’s (strangely blurred?) Chart of memory errors in Android. The old code has already had most of the errors fixed.

Google

Google says rewriting “tens of thousands of lines” of existing C and C ++ Android code in Rust is “simply not feasible”, and rewriting old Android would have nothing to do as old code has gotten the most bugs knocked out of it by now. Since the Android source code is an open source project with billions of users, there are many eyeballs on it. Google says that “most of our memory errors occur in new or recently changed code, where about 50% are less than a year old.” Rust will be used for new components when needed, which can help reduce any new memory errors that Google could introduce.

Google closes the blog post, saying: “In the last 18 months, we’ve added Rust support to the Android Open Source project, and we have a couple of early adoption projects that we’ll share in the coming months. Get updated, we’ll post more updates on this blog. “


Source link