安全与隐私blog.adacore.com
Nvidia 安全团队:“干脆不用 C 语言会怎样?”
Nvidia Security Team: “What if we just stopped using C?” (2022)
2022 — 2025,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
本文介绍 Nvidia 安全团队 2022 年的一次实践探讨:能否在部分代码中放弃 C,改用内存安全的 Ada/SPARK 语言来降低漏洞率。文章基于 AdaCore 与 Nvidia 的案例研究,展示了用更安全的语言重写或新写代码后安全状况的改善。
为什么经久不衰:内存安全是近年系统编程的核心议题,Nvidia 这样的巨头亲自尝试弃用 C,为“渐进迁移到安全语言”提供了有分量的真实案例,2025 年再次登上首页说明其参考价值仍在。
HN 评论精选
用石棉类比 C:明知不安全却因情感惯性继续使用,而安全替代品早已存在
C 就像石棉:它干得不错、性能好,但安全问题 outweigh 了优点。区别在于我们当年因为不安全而停用了石棉——它还在旧建筑里,翻修时被替换,新工程不再使用。不知为何,用 C 这件事总带着强烈的情感因素。更安全的替代品明明存在。如果有承包商说石棉没问题、只要雇高手把墙补好不让纤维漏出来,你一定会笑掉大牙;但我们对 C 天天这么说,而 CVE 还在源源不断地堆积。
docandrew查看英文原文
C is like asbestos. It was fine at what it did, good performance, but the safety problems outweigh them. The difference is that we _stopped using asbestos_ because it was unsafe. It’s still around but being replaced during renovations, and no new installations use it. For whatever reason with C there’s this huge emotional component to it. Safer alternatives exist. You’d rightfully laugh at a contractor who suggested asbestos is fine, if you make sure to use only highly-skilled installers who patch up the drywall so that no fibers can escape. But with C we say that all the time, and the CVEs keep piling up.
认为 Ada 在安全加固方面比 Rust 更实用、更少隐式魔法
Ada 是更好的 Rust :) 我知道两者的方法不一样,但目标足够接近。而且我认为 Ada 的核心原则对加固代码来说更有用、也更少“魔法”。
stephc_int13查看英文原文
Ada is the better Rust :) I know the approach is not the same, but the goals are similar enough. And I think that Ada core principles are more useful and less "magical" for hardening code.
质疑“换语言就能解决问题”的思路,提醒 C 有其适用领域,重蹈覆辙源于不了解历史
难道所有问题都能靠增加或去掉一层抽象来解决吗?也许像任何工具集一样,C 有一个并非人人能理解的最优问题域,而且这往往与 LLVM 编译器无关。那些没有搞懂 C++ 为何演变成今天这个样子的人,注定会天真地把同样诱人的糟糕设计选择再迭代一遍。
Joel_Mckay查看英文原文
What if all problems were solvable by adding or removing a layer of abstraction? Perhaps, like any other tool-set... C has an optimal problem domain not everyone can understand, and it is often unrelated to llvm compilers. Those who failed to learn why C++ evolved into its current state, are simply doomed to naively make another iteration of the same tantalizing bad design choices. https://en.wikipedia.org/wiki/Second-system_effect
提供案例研究 PDF 的备用/存档链接
那个 PDF 加载很慢,这里是可以访问的存档链接。
xet7查看英文原文
That PDF was slow to load, but here it is: https://web.archive.org/web/20221107153324/https://releases.wekan.team/ada/222559-adacore-nvidia-case-study-v5.pdf https://releases.wekan.team/ada/222559-adacore-nvidia-case-study-v5.pdf
历次讨论
同类还值得读
非法素数
Illegal prime
维基百科条目,介绍“非法素数”:某些素数之所以被称为“非法”,是因为它们经特定编码后,恰好对应一段被法律禁止传播的数据——最著名的是 DVD 解密程序 DeCSS 的代码,有人把…
安全与隐私上首页 5 次 · 2010–2021en.wikipedia.org编辑精选关于 /dev/urandom 的常见误区
Myths about /dev/urandom
(Thomas Hühn 撰写,2014 年首发并持续更新)逐条反驳关于 /dev/urandom 的常见误解:它与 /dev/random 使用的是同一个 CSPRNG,一旦完…
安全与隐私上首页 5 次 · 2014–20202uo.de编辑精选AES 高级加密标准火柴人图解
A Stick Figure Guide to the Advanced Encryption Standard (AES)
一篇用火柴人漫画形式讲解 AES(高级加密标准)算法的经典科普文章。
安全与隐私上首页 5 次 · 2009–2022moserware.com编辑精选指纹是用户名,不是密码
Fingerprints are Usernames, not Passwords
作者(eCryptfs 维护者、Ubuntu 安全工程师)认为指纹等生物特征是公开、不可更改的标识,应视作用户名而非密码,不能当作秘密凭据用于认证。
安全与隐私上首页 4 次 · 2013–2017blog.dustinkirkland.comHTTPS 连接的最初几毫秒(2009)
The First Few Milliseconds of an HTTPS Connection (2009)
逐毫秒拆解一次 HTTPS 连接建立时发生了什么,重点讲 TLS 握手、证书验证、RSA 签名与密钥协商等机制,面向不熟悉该领域的读者。
安全与隐私上首页 4 次 · 2009–2020moserware.com编辑精选