To accelerate the transition to memory safe programming languages, the US Defense Advanced Research Projects Agency (DARPA) is driving the development of TRACTOR, a programmatic code conversion vehicle.
The term stands for TRanslating All C TO Rust. It’s a DARPA project that aims to develop machine-learning tools that can automate the conversion of legacy C code into Rust.
The reason to do so is memory safety. Memory safety bugs, such buffer overflows, account for the majority of major vulnerabilities in large codebases. And DARPA’s hope is that AI models can help with the programming language translation, in order to make software more secure.
“You can go to any of the LLM websites, start chatting with one of the AI chatbots, and all you need to say is ‘here’s some C code, please translate it to safe idiomatic Rust code,’ cut, paste, and something comes out, and it’s often very good, but not always,” said Dan Wallach, DARPA program manager for TRACTOR, in a statement.
- MajorHavoc ( @MajorHavoc@programming.dev ) 69•2 months ago
“You can go to any of the LLM websites, start chatting with one of the AI chatbots, and all you need to say is ‘here’s some C code, please translate it to safe idiomatic Rust code,’ cut, paste, and something comes out, and it’s often very good, but not always,” said Dan Wallach, DARPA program manager for TRACTOR, in a statement.
“This parlor trick impressed me. I’m sure it can scale to solve difficult real world problems.”
It’s a promising approach worth trying, but I won’t be holding my breath.
If DARPA really wanted safer languages, they could be pushing test coverage, not blindly converting stable well tested C code into untested Rust code.
This, like most AI speculation, reeks of looking for shortcuts instead of doing the boring job at hand.
- kbin_space_program ( @kbin_space_program@kbin.run ) 48•2 months ago
It reeks of a consultant who sold upper management via a gated demo.
- thingsiplay ( @thingsiplay@beehaw.org ) 11•1 month ago
Also:
As to the possibility of automatic code conversion, Morales said, “It’s definitely a DARPA-hard problem.” The number of edge cases that come up when trying to formulate rules for converting statements in different languages is daunting, he said.
- ByteOnBikes ( @ByteOnBikes@slrpnk.net ) 8•1 month ago
I’m thinking they also want to future proof this.
The quantity of C devs are dying. It’s a really difficult language to get competent with.
- MajorHavoc ( @MajorHavoc@programming.dev ) 2•1 month ago
That’s a really valid point.
- ulterno ( @ulterno@lemmy.kde.social ) English1•1 month ago
A really unfortunate one too.
- 0x0 ( @0x0@programming.dev ) 4•1 month ago
If DARPA really wanted safer languages, they could be pushing test coverage,
Or Ada…
- FizzyOrange ( @FizzyOrange@programming.dev ) 2•1 month ago
Ada is not strictly safer. It’s not memory safe for example, unless you never free. The advantage it has is mature support for formal verification. But there’s literally no way you’re going to be able to automatically convert C to Ada + formal properties.
In any case Rust has about a gazillion in-progress attempts at adding various kinds of formal verification support. Kani, Prusti, Cruesot, Verus, etc. etc. It probably won’t be long before it’s better than Ada.
Also if your code is Ada then you only have access to the tiny Ada ecosystem, which is probably fine in some domains (e.g. embedded) but not in general.
- Mischala ( @Mischala@lemmy.nz ) 42•1 month ago
turning C code automatically into Rust…
Oh wow they must have some sick transpiler, super exciting…
With AI, of course
God fucking damnit.
- runeko ( @runeko@programming.dev ) 6•1 month ago
You want Skynet? 'Cause that’s how you get Skynet.
- Redkey ( @Redkey@programming.dev ) 2•1 month ago
Maybe, but it’s gonna be more like SkyNet with electrolytes; it’s what terminators crave.
- Vivendi ( @Vivendi@lemmy.zip ) 35•1 month ago
Code works in C
Want to make it safer
Put it into a fucking LLM
You know sometimes I wonder if I’m an idiot or that maybe I just don’t have the right family connections to get a super high paying job
- douglasg14b ( @douglasg14b@programming.dev ) 4•1 month ago
Too bad commenters are as bad as reading articles as LLMs are at handling complex scenarios. And are equally as confident with their comments.
This is a pretty level headed, calculated, approach DARPA is taking (as expected from DARPA).
- AlexWIWA ( @AlexWIWA@lemmy.ml ) English20•2 months ago
It’d be nice if they open source this like they did with ghidra. The video game reverse engineering and modernization efforts have been much easier thanks to the government open sourcing their tools
- Miaou ( @Miaou@jlai.lu ) 2•1 month ago
Ghidra is open source?! How did I miss this!
- The_Decryptor ( @The_Decryptor@aussie.zone ) English15•1 month ago
c2rust: Am I a joke to you?
- zaphod ( @zaphod@sopuli.xyz ) 14•1 month ago
I threw some simple code at it and it even put
unsafe
on the main function, what’s the point of Rust then if everything isunsafe
?- JackbyDev ( @JackbyDev@programming.dev ) English6•1 month ago
Baby steps. It’s easier to convert code marked unsafe in Rust to not need unsafe than it is convert arbitrary code in other languages to Rust code that doesn’t need unsafe.
- ByteOnBikes ( @ByteOnBikes@slrpnk.net ) 6•1 month ago
For all of our sake, I hope humans are the final set of eyes before the code is used in prod.
- ulterno ( @ulterno@lemmy.kde.social ) English0•1 month ago
And I hope that’s not someone who doesn’t understand the
static
keyword after 2+ years of C++ development.
- The_Decryptor ( @The_Decryptor@aussie.zone ) English4•1 month ago
Ideally you don’t directly ship the code it outputs, you use it instead of re-writing it from scratch and then slowly clean it up.
Like Mozilla used it for the initial port of qcms (the colour management library they wrote for Firefox), then slowly edited the code to be idiomatic rust code. Compare that to something like librsvg that did a function by function port
- NigelFrobisher ( @NigelFrobisher@aussie.zone ) 9•1 month ago
Thirty percent of the time it works all of the time!
- echindod ( @echindod@programming.dev ) 1•1 month ago
Using an LLM to come up with function names for transpiled code would be a good idea, but other than that. Nope.