Hacker News 中文摘要

RSS订阅

DARPA项目:C语言至Rust的自动翻译(2024年) -- DARPA project for automated translation from C to Rust (2024)

文章摘要

美国国防高级研究计划局(DARPA)正在开展研究项目,旨在从根本上消除内存安全漏洞这一长期困扰软件安全的重大问题。该项目寻求开发创新技术,从源头解决内存访问错误等安全隐患。

文章总结

彻底消除内存安全漏洞

美国国防高级研究计划局(DARPA)近日宣布启动"全面C转Rust计划"(TRACTOR),旨在通过自动化手段将全球广泛使用的C语言遗留代码转换为更安全的Rust编程语言,从根本上解决内存安全问题。

内存安全问题的严峻现状

内存安全漏洞是目前最常见的软件漏洞类型,主要表现为两种形式: 1. C等语言允许直接操作内存,容易因编程错误导致内存状态损坏 2. 当编程语言出现"未定义行为"时,也会引发内存安全问题

行业共识与转型契机

经过二十多年与C/C++内存安全问题的斗争,软件工程界已达成共识: - 仅依赖漏洞检测工具远远不够 - 美国国家网络总监办公室已呼吁采取更积极的解决方案

近年来两大趋势为转型创造了条件: 1. Rust语言逐渐获得行业认可 2. 大语言模型(LLM)等机器学习技术取得突破性进展

TRACTOR计划的技术路径

该计划将: - 结合静态分析、动态分析和LLM等创新技术 - 通过公开竞赛测试各解决方案的转换能力 - 确保转换后的代码达到专业Rust开发者的质量水平

DARPA项目经理Dan Wallach博士指出:"Rust的严格规则就像护栏,开发者适应后反而能获得更大自由。我们的目标是让转换后的代码完全消除C程序中的内存安全漏洞类问题。"

后续安排

DARPA将于2024年8月26日举办提案日活动,参会者可通过线上或线下方式参与。报名截止日期为8月19日。

(注:原文中的导航菜单、页脚信息等非核心内容已作删减处理)

评论总结

以下是评论内容的总结:

  1. 对Rust语言的批评

    • 语法丑陋,影响代码可读性:
      • "I'm impressed that the language is even uglier than bad C++" (andrewmcwatters)
      • "If Rust didn’t have the syntax warts (macros), it would be eating the world." (IceHegel)
    • 安全性宣传存在误导:
      • "leads developers to think they're writing safe software that in specific cases, actually just promotes silent failure" (andrewmcwatters)
      • "The argument for using Rust instead of a memory safe implementation of C is all about performance." (pizlonator)
  2. 对C/C++与Rust转换的看法

    • 转换难度大,架构调整多:
      • "Quite a bit of idiomatic and safe C++ doesn't 'translate' well to Rust without large amounts of rearchitecting." (bangaladore)
    • 工具链优势明显:
      • "The tooling is actually more important than the borrow checker and memory safety in my opinion." (IceHegel)
      • "If I clone a Rust repo, it’s actually easier to compile, test, and run the code than any other language." (IceHegel)
  3. 对DARPA项目的讨论

    • 项目技术细节:
      • "uses Verified Lifting, which combines formal methods and program analysis with AI techniques" (Animats)
      • "The old C2Rust is all downhill... The test case which caused a segfault in the C version also caused a segfault in the unsafe Rust version." (Animats)
    • 命名争议:
      • "Shouldn't they change it to WARPA to reflect the Dept of War name change?" (observationist)
  4. 其他观点

    • C语言通过工具链可实现安全:
      • "C with proper tooling extremely safe." (pyuser583)
    • 行业选择多样性:
      • "There’s no consensus on Rust being the safe bet. Lots of orgs are going with alternatives, like Swift, Zig, C++-with-changes" (pizlonator)