2

Android内存安全漏洞大幅减少,Rust成为关键因素

 1 year ago
source link: https://blog.p2hp.com/archives/10091
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Android内存安全漏洞大幅减少,Rust成为关键因素 | Lenix Blog从 Android 12 开始,Google 就在 Android 系统中带来了 Rust 语言的支持,作为 C/C 的替代方案,他们的目标并不是把现有的 C/C 代码都转换成为 Rust,而是在新编写的代码中使用 Rust 语言开发。通过将越来越多的 Rust 代码集成到其 Android 操作系统中,Google 在减少漏洞方面的努力最终是获得了回报。Google 在公告中表示,"在过去几年 / 几个 Android 系统版本中,内存安全漏洞的数量大幅下降"。

图片

具体而言,2019 年至 2022 年期间,每年的内存安全漏洞数量从最初的 223 个下降到如今的 85 个。内存安全漏洞现在在 Android 系统总漏洞的占比也只有 35%,四年前的占比则是 76%,而且 2022 年也是内存安全漏洞首次不再是 Android 系统漏洞最大占比的一年。在此期间,进入 Android 系统的新内存不安全代码的数量也已经减少。

图片

Rust 占了 Android 13 所有新的原生代码的 21%,在 AOSP 中已经有大约 150 万行 Rust 代码,涵盖各种功能和元件,其中就包括超宽带(UWB)栈、DNS-over-HTTP3、Keystore2、Android 的虚拟化框架(AVF),以及各种其他组件及其开源依赖。到目前为止,在整个 Android 12 和 13 系统中,Rust 代码中发现的内存安全漏洞为零,这是一个重要的发现,因为过去 Android 漏洞密度大于 1/kLOC,也就是说,每一千行代码至少会发现一个漏洞,基于 Rust 代码的行数来看,此举可能已经阻挡了成百上千个漏洞进入 Android 系统。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK