{"id":4827,"date":"2024-08-13T07:28:23","date_gmt":"2024-08-13T12:28:23","guid":{"rendered":"https:\/\/www.darkreading.com\/application-security\/darpa-aims-to-ditch-c-code-move-to-rust"},"modified":"2024-08-13T07:28:23","modified_gmt":"2024-08-13T12:28:23","slug":"darpa-aims-to-ditch-c-code-move-to-rust","status":"publish","type":"post","link":"https:\/\/ddi.mohflo.net\/index.php\/2024\/08\/13\/darpa-aims-to-ditch-c-code-move-to-rust\/","title":{"rendered":"DARPA Aims to Ditch C Code, Move to Rust"},"content":{"rendered":"<div class=\"media_block\"><a href=\"https:\/\/i0.wp.com\/eu-images.contentstack.com\/v3\/assets\/blt6d90778a997de1cd\/blt5f435ad2bd1455e4\/66b67e858365acc482f6d26e\/TippaPatt-AI-code-shutterstock.jpg?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/ddi.mohflo.net\/wp-content\/uploads\/2024\/08\/darpa-aims-to-ditch-c-code-move-to-rust.jpg?w=640&#038;ssl=1\" class=\"media_thumbnail\"><\/a><\/div>\n<div><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/ddi.mohflo.net\/wp-content\/uploads\/2024\/08\/darpa-aims-to-ditch-c-code-move-to-rust.jpg?w=640&#038;ssl=1\" class=\"ff-og-image-inserted\"><\/div>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">The US military agency responsible for developing new technologies plans to embark on an effort to rewrite significant volumes of C code by funding a new research challenge to create an automated translator capable of converting old C code with function written in the security-focused Rust language.<\/span><\/p>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">The Defense Advanced Research Projects Agency (DARPA) will hold a workshop, known as Proposers Day, on Aug. 26 to outline its vision for <\/span><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\"><a class=\"ContentText-BodyTextChunk ContentText-BodyTextChunk_link\" target=\"_blank\" href=\"https:\/\/www.darpa.mil\/program\/translating-all-c-to-rust\" rel=\"noopener\">the Translating All C to Rust (TRACTOR) project<\/a><\/span><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">. The effort calls for academic and industry research groups to compete to create a system that can turn C code into idiomatic \u2014 that is, using native features \u2014 Rust code. The project&#8217;s ultimate goal is to provide tools so that any organization with large volumes of software written in C can convert that code to Rust and eliminate the memory-safety errors that account for a large source of software vulnerabilities.<\/span><\/p>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">Without an automated system, developers are unlikely to take on the task, says Dan Wallach, program manager in DARPA&#8217;s Information Innovation Office (I2O).<\/span><\/p>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">&#8220;Today, rewriting code is expensive and labor-intensive, and [organizations] with large legacy codebases simply cannot afford that in many cases,&#8221; he says. &#8220;The best advice today is, &#8216;Well, get started anyway and do it incrementally.&#8217; But if we can create a high degree of automation, then that changes the economics of the problem and makes it possible to improve code faster.&#8221;<\/span><\/p>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">Technology companies and the US government have identified memory-safety flaws as a common, <\/span><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\"><a class=\"ContentText-BodyTextChunk ContentText-BodyTextChunk_link\" target=\"_blank\" href=\"https:\/\/www.darkreading.com\/application-security\/shift-memory-safe-languages-gains-momentum\" rel=\"noopener\">but entirely preventable<\/a><\/span><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">, class of software vulnerabilities. In December 2022, Google disclosed that, in the software for the latest version of Android, the majority of new code was written in the memory-safe languages of Java, Kotlin, and Rust, leading to far fewer memory-safety vulnerabilities \u2014 <\/span><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\"><a class=\"ContentText-BodyTextChunk ContentText-BodyTextChunk_link\" target=\"_blank\" href=\"https:\/\/security.googleblog.com\/2022\/12\/memory-safe-languages-in-android-13.html\" rel=\"noopener\">85 in 2022 compared to 223 in 2019<\/a><\/span><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">.<\/span><\/p>\n<h2 class=\"ContentText ContentText_variant_h2 ContentText_align_left\" data-testid=\"content-text\" id=\"Rust to the Rescue\">Rust to the Rescue<\/h2>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">Because memory-safety issues \u2014 <\/span><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\"><a class=\"ContentText-BodyTextChunk ContentText-BodyTextChunk_link\" target=\"_blank\" href=\"https:\/\/cwe.mitre.org\/data\/definitions\/1399.html\" rel=\"noopener\">such as buffer overflows and double-free errors<\/a><\/span><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\"> \u2014 typically occur in C and C++ code, technical experts have recommended moving to Rust, a memory-safe language that meets many of the same requirements as those languages. Google found, for example, that rewriting the QR code generator for Chrome in Rust allowed the developers to move it from the application&#8217;s sandbox, speeding performance. Microsoft has rewritten some operating system functions in Rust and <\/span><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\"><a class=\"ContentText-BodyTextChunk ContentText-BodyTextChunk_link\" target=\"_blank\" href=\"https:\/\/www.darkreading.com\/application-security\/google-microsoft-take-refuge-in-rust-languages-better-security\" rel=\"noopener\">found a 5% to 15% performance improvement<\/a><\/span><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">.<\/span><\/p>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">In fact, Rust continues to be the language with which the greatest number of developers want to work, with 82% of developers &#8220;admiring&#8221; the programming language, compared to the 29% who currently extensively use the language, <\/span><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\"><a class=\"ContentText-BodyTextChunk ContentText-BodyTextChunk_link\" target=\"_blank\" href=\"https:\/\/survey.stackoverflow.co\/2024\/\" rel=\"noopener\">according to StackOverflow&#8217;s &#8220;2024 Developer Survey.&#8221;<\/a><\/span><\/p>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">Many organizations are already using \u2014 or starting to use \u2014 Rust, says Beth Linker, senior director of product management for Synopsys&#8217; Software Integrity Group.<\/span><\/p>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">&#8220;We\u2019ve seen a lot of momentum around Rust in the last 12 to 18 months because of the US government\u2019s stance on memory-safe programming languages,&#8221; she says.<\/span><\/p>\n<h2 class=\"ContentText ContentText_variant_h2 ContentText_align_left\" data-testid=\"content-text\" id=\"LLMs Necessary But Not Sufficient\">LLMs Necessary But Not Sufficient<\/h2>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">Yet to use Rust widely, companies need to make sure that the Rust code uses features of the programming language and is interoperable with other components that may still be written in C or C++. For that reason, large language models (LLMs) will likely be necessary, even if they cannot yet translate C-to-Rust code totally accurately, Linker says.<\/span><\/p>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">&#8220;In our experience using LLMs to generate Rust code, we have seen that this is still a growth area for many LLMs because there is less training data available for Rust than for more established languages,&#8221; she says. &#8220;TRACTOR is an ambitious project and will be very impactful if it succeeds.&#8221;<\/span><\/p>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">While artificial intelligence (AI) is not a requirement for the project, DARPA&#8217;s Wallach thinks that LLMs will almost certainly be part of the solutions. They could contribute in many different areas, from translation to code evaluation to process control \u2014 there is no one right way to do it, he says.<\/span><\/p>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">And because the pace of AI innovation is moving so quickly, any particular solution should not rely on a specific implementation, Wallach adds.<\/span><\/p>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">&#8220;Whatever the state of the art is for LLMs today, I promise you in four years, there will be something better. I don&#8217;t know what it is, I don&#8217;t know who&#8217;s going to make it, but I know that that world is improving on its own,&#8221; he says. &#8220;So our goal is to be able to benefit from the investments that other people are making in AI.&#8221;<\/span><\/p>\n<h2 class=\"ContentText ContentText_variant_h2 ContentText_align_left\" data-testid=\"content-text\" id=\"Significant Challenges to Overcome\">Significant Challenges to Overcome<\/h2>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">The need for the solution to easily swap older LLMs for newer, more efficient models will likely cause issues. Already, the intellectual-property challenges that come will AI models are significant, says Chris Clark, automotive systems architect for Synopsys&#8217;s Software Integrity Group.<\/span><\/p>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">&#8220;This raises many questions about IP, usage, analysis, and model development. The challenge will not be whether an AI engine can be developed; the challenge will be in the legal domain and licensing,&#8221; Clark says. &#8220;The question about how my code is used and what is derived from it will have to be answered. For embedded, this is especially important.&#8221;<\/span><\/p>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">Overall, DARPA realizes that creating TRACTOR will rely on significant innovations in the technology of LLMs and source-code translation, and that the entire exercise will likely bring up some thorny issues, such as, for example, whether creating Rust code that matches the C code is the criteria, or whether the system should try to gauge the intent of the programmer.<\/span><\/p>\n<p class=\"ContentParagraph ContentParagraph_align_left\" data-testid=\"content-paragraph\"><span class=\"ContentText ContentText_variant_bodyNormal\" data-testid=\"content-text\">&#8220;There&#8217;s no doubt that this is a hard problem, and DARPA doesn&#8217;t do easy problems. DARPA does hard problems,&#8221; Wallach says. &#8220;It&#8217;s not enough simply to yield Rust code that is safe but unreadable and unusable. The whole point of this is that we want to move developers from C to Rust &#8230; so to the extent possible, we want it to be the highest-quality Rust that can be produced.&#8221;<\/span><\/p>\n<p><a href=\"https:\/\/www.darkreading.com\/application-security\/darpa-aims-to-ditch-c-code-move-to-rust\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The US military agency responsible for developing new technologies plans<\/p>\n","protected":false},"author":12,"featured_media":4828,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[809],"class_list":["post-4827","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-dark-reading"],"featured_image_urls":{"full":["https:\/\/i0.wp.com\/ddi.mohflo.net\/wp-content\/uploads\/2024\/08\/darpa-aims-to-ditch-c-code-move-to-rust.jpg?fit=1920%2C1080&ssl=1",1920,1080,false],"thumbnail":["https:\/\/i0.wp.com\/ddi.mohflo.net\/wp-content\/uploads\/2024\/08\/darpa-aims-to-ditch-c-code-move-to-rust.jpg?resize=150%2C150&ssl=1",150,150,true],"medium":["https:\/\/i0.wp.com\/ddi.mohflo.net\/wp-content\/uploads\/2024\/08\/darpa-aims-to-ditch-c-code-move-to-rust.jpg?fit=300%2C169&ssl=1",300,169,true],"medium_large":["https:\/\/i0.wp.com\/ddi.mohflo.net\/wp-content\/uploads\/2024\/08\/darpa-aims-to-ditch-c-code-move-to-rust.jpg?fit=640%2C360&ssl=1",640,360,true],"large":["https:\/\/i0.wp.com\/ddi.mohflo.net\/wp-content\/uploads\/2024\/08\/darpa-aims-to-ditch-c-code-move-to-rust.jpg?fit=640%2C360&ssl=1",640,360,true],"1536x1536":["https:\/\/i0.wp.com\/ddi.mohflo.net\/wp-content\/uploads\/2024\/08\/darpa-aims-to-ditch-c-code-move-to-rust.jpg?fit=1536%2C864&ssl=1",1536,864,true],"2048x2048":["https:\/\/i0.wp.com\/ddi.mohflo.net\/wp-content\/uploads\/2024\/08\/darpa-aims-to-ditch-c-code-move-to-rust.jpg?fit=1920%2C1080&ssl=1",1920,1080,true],"chromenews-featured":["https:\/\/i0.wp.com\/ddi.mohflo.net\/wp-content\/uploads\/2024\/08\/darpa-aims-to-ditch-c-code-move-to-rust.jpg?fit=1024%2C576&ssl=1",1024,576,true],"chromenews-large":["https:\/\/i0.wp.com\/ddi.mohflo.net\/wp-content\/uploads\/2024\/08\/darpa-aims-to-ditch-c-code-move-to-rust.jpg?resize=825%2C575&ssl=1",825,575,true],"chromenews-medium":["https:\/\/i0.wp.com\/ddi.mohflo.net\/wp-content\/uploads\/2024\/08\/darpa-aims-to-ditch-c-code-move-to-rust.jpg?resize=590%2C410&ssl=1",590,410,true]},"author_info":{"display_name":"Dark Reading","author_link":"https:\/\/ddi.mohflo.net\/index.php\/author\/darkreading\/"},"category_info":"<a href=\"https:\/\/ddi.mohflo.net\/index.php\/category\/uncategorized\/\" rel=\"category tag\">Uncategorized<\/a>","tag_info":"Uncategorized","comment_count":"0","jetpack_featured_media_url":"https:\/\/i0.wp.com\/ddi.mohflo.net\/wp-content\/uploads\/2024\/08\/darpa-aims-to-ditch-c-code-move-to-rust.jpg?fit=1920%2C1080&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ddi.mohflo.net\/index.php\/wp-json\/wp\/v2\/posts\/4827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ddi.mohflo.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ddi.mohflo.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ddi.mohflo.net\/index.php\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/ddi.mohflo.net\/index.php\/wp-json\/wp\/v2\/comments?post=4827"}],"version-history":[{"count":0,"href":"https:\/\/ddi.mohflo.net\/index.php\/wp-json\/wp\/v2\/posts\/4827\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ddi.mohflo.net\/index.php\/wp-json\/wp\/v2\/media\/4828"}],"wp:attachment":[{"href":"https:\/\/ddi.mohflo.net\/index.php\/wp-json\/wp\/v2\/media?parent=4827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ddi.mohflo.net\/index.php\/wp-json\/wp\/v2\/categories?post=4827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ddi.mohflo.net\/index.php\/wp-json\/wp\/v2\/tags?post=4827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}