Rust - now on Android

The correctness of the code on the Android platform is the most important aspect in the context of the security, stability and quality of each Android release. Memory-safety bugs found in C and C ++ code are still the hardest to clean up. Google invests tremendous efforts and resources in detecting, eliminating bugs of this kind, as well as in reducing the harm from them, trying to keep bugs in Android releases as few as possible. However, despite all these measures, bugs related to memory safety remain a major source of stability problems. They invariably account for ~ 70% of the most serious Android vulnerabilities.





Along with ongoing  and  planned  efforts to improve memory bug detection, Google is also stepping up its efforts to prevent them. Memory-safe languages ​​are the most efficient and cost-effective means to accomplish this task. The Android Open Source Project (AOSP) now supports the memory-safe Java and Kotlin languages, Rust, for developing the operating system itself.





System Programming

Managed languages ​​such as Java and Kotlin are best suited for developing Android applications. These languages ​​were designed with ease of use, portability, and security in mind. The Android Runtime (ART)  manages memory as specified by the developer. The Android operating system uses Java extensively, effectively protecting large portions of the Android platform from memory bugs. Unfortunately, at low levels of Android OS, Java and Kotlin are powerless.  





, C, C++ Rust. . . , .



C C++ . , ,  .





Rust , , , . , , C C++.





C C++ , Rust, . Android , , , . : , .  





Android , , C/C++ , .   , , . – ; ,   , . , , .





, , , Rust, :





  1. , .





  2. , , .





C++?

, , C/C++.





, ( ) , Android ,  C/C++. , , 50% .





, , , . , , , , , . , .





   , , Rust. , – , , . , , , .





,   , . . – .





, , . C/C++, , , ,  .





, , , . , .





Rust , :





  • –  .





  • –  . , , Rust  Β« Β».





  • –  (., , ).





  • –  . , . , C++ const, . , Rust , , .





  • –  Result, , .  Rage Against the Cage, - . ? Result , Rust , .





  • – , . , Android 3-5% , . Android 11, ,   C/C++. , , , , . Rust , . . Clang C/C++, Rust , .





  • –  Rust , wrapping_add, , saturating_add – . Android. , : .   





Android – . , , , . . . Google.








All Articles