Memory safe languages in Android 13

In Android 13, about 21% of all new native code (C/C++/Rust) is in Rust. There are approximately 1.5 million total lines of Rust code in AOSP across new functionality and components such as Keystore2, the new Ultra-wideband (UWB) stack, DNS-over-HTTP3, Android’s Virtualization framework (AVF), and various other components and their open source dependencies. These are low-level components that require a systems language which otherwise would have been implemented in C++.

[…]

To date, there have been zero memory safety vulnerabilities discovered in Android’s Rust code.

We don’t expect that number to stay zero forever, but given the volume of new Rust code across two Android releases, and the security-sensitive components where it’s being used, it’s a significant result. It demonstrates that Rust is fulfilling its intended purpose of preventing Android’s most common source of vulnerabilities. Historical vulnerability density is greater than 1/kLOC (1 vulnerability per thousand lines of code) in many of Android’s C/C++ components (e.g. media, Bluetooth, NFC, etc). Based on this historical vulnerability density, it’s likely that using Rust has already prevented hundreds of vulnerabilities from reaching production.

These numbers don’t lie.

22 Comments

  1. 2022-12-01 9:24 pm
    • 2022-12-02 3:46 am
      • 2022-12-02 4:59 am
        • 2022-12-03 1:48 am
          • 2022-12-03 5:47 am
          • 2022-12-04 1:33 am
          • 2022-12-04 3:05 am
          • 2022-12-04 3:11 am
          • 2022-12-05 5:58 am
          • 2022-12-05 11:49 am
          • 2022-12-05 4:44 pm
          • 2022-12-06 9:34 am
          • 2022-12-06 9:46 am
  2. 2022-12-02 6:20 am
    • 2022-12-02 6:46 am
      • 2022-12-02 9:55 am
        • 2022-12-02 2:57 pm
          • 2022-12-05 7:33 pm
    • 2022-12-05 7:37 pm
    • 2022-12-08 4:03 am
      • 2022-12-08 7:48 am