Hacker Newsnew | past | comments | ask | show | jobs | submit | ericseppanen's commentslogin

"we model a scenario where the original code is memory-safe; the ported code is memory-safe; and we consider memory safety and undefined behavior that may arise across the FFI layer between the two pieces of code."

I may be stating the obvious, but that's a bit of a strawman. Yes, writing good FFI code is hard; yes it could result in security/soundness issues; yes, we could use better tools in this space.

But nobody rewrites C code in Rust if they believe existing codebase is free of memory safety hazards; they rewrite it because they think the result will contain fewer hazards, even accounting for the potential problems at the FFI boundary.

If I could remove tens of thousands of lines of hard-to-analyze C code, and replace it with tens of thousands of lines of safe Rust, paired with a few hundred lines of hard-to-analyze FFI adapters, that sounds like a pretty good tradeoff to me. I now know exactly where to focus my attention, and I can have confidence that the situation will only improve with time: better tooling may allow me to improve the dangerous FFI layer, and in the meantime I can recklessly improve the safe Rust module without fear of introducing new memory unsafety bugs, unsound behavior, or data races.


Exactly. No one is saying "rewrite it in Rust because it already works". They typically say it because the thing in question is a bug farm, or it's really difficult to maintain.

I looked for the author's (whoever they are) proposed solution and it's this:

"This is because many of the FFI bugs surveyed are fundamentally cross-language issues. Instead, we propose that both C and Rust must conform to a shared, formally-based domain-specific language, which provides a safe-by-construction abstraction over the FFI boundary."

Such a thing is a "new thing", and isn't going to retroactively apply to the legacy C code written before this new thing... so how does that help?

(Full disclosure: I'm a professional programmer who has written in C, C++, C# for many years, and now I choose to write new things in Rust.)


> Exactly. No one is saying "rewrite it in Rust because it already works". They typically say it because the thing in question is a bug farm, or it's really difficult to maintain.

Well some people are. Is there a word for attacking the weakest real version of an opposing argument? Strawman usually implies you are attacking a fake version of the argument, but on the internet you can usually find someone who actually holds an easily refuted point of view, just because of the law of large numbers...


Usually that's called a weakman argument. Steelman is the opposite, where you look for an opponent's strongest arguments to critique/refute.


> it's really difficult to maintain

Typically the Rust Evangelization Task Force does not include people who are actually going to maintain the software (or do the rewrite themselves).


How’s the job market for Rust? Would someone with a good amount of Scala and Python experience and some Rust have a decent shot?


Scala, yes.

It’s still growing.

The companies that do commit to Rust usually have a fair amount of work ahead.

And the typical developers are C/C++ developers who sometimes bring a bunch of unsafe habits that make the whole transition kind of pointless.


> nobody rewrites C code in Rust if they believe existing codebase is free of memory safety hazards

I'd offer that even if the existing codebase is free of memory safety hazards, low confidence in future changes being able to keep it free of memory safety hazards in a cost efficient manner is a motivation to migrate.


This is so true.

The idea that a program can approach some optimal bug-free state, never to be modified or refactored again, doesn't resemble any project I've ever encountered.


> But nobody rewrites C code in Rust if they believe existing codebase is free of memory safety hazards; they rewrite it because they think the result will contain fewer hazards

What if someone makes a strawman out of memory problems so they can rewrite it in Rust ?


Great, let them do whatever they want


> But nobody rewrites C code in Rust if they believe existing codebase is free of memory safety hazards; they rewrite it because they think the result will contain fewer hazards, even accounting for the potential problems at the FFI boundary.

That's pretty generous. They re-write it in rust because a "Show HN: Thing-X, in Rust gets upvotes."


Citation needed… lol

But seriously, that’s kinda silly to propose as a motive for a software project requiring significant effort.


agree, i wanted to just add that this paper might be right for projects that are not actively developed anymore something like bash or coreutils etc, as there this is fairly well tested code and there aren't that many added features that could introduce issues.

for anything that is actively developed it's a whole other story, even if you are confident that the current codebase is safe, each added feature has a risk that it breaks some unwritten contract somewhere and introduces security issues.

eg. look at recent vulnerability in sudo, at and second sight it was safe and secure, triggering it required unobvious corner case.

how many of similar issues you could have in your codebase that could be dormant for years?



I didn't mean that those projects are not maintained, rater that there aren't intensive changes anymore.

Coreutils:

> There have been 26 commits by 3 people in the 29 days since 9.2

Bash looks like didn't has any commit this year yet


> Bash looks like didn't has any commit this year yet

Does anyone know why this is? Is it because doing anything would cause POSIX divergence? Nobody wants to (because it's an "ugh experience")? It's considered effectively complete?

Genuinely curious.

I don't actually use Bash for my personal shell, thought. I do write bash scripts semi-regularly though.


All of the commits are from Chet Ramey, who the wiki says took over maintenance on bash just shy of 30 years ago.

It looks like its busy in the devel branch.

https://git.savannah.gnu.org/cgit/bash.git/log/?h=devel

The last commit from anyone else was Jari Aalto in 2009? Wow.

If he's committing on behalf of anyone else, it isn't mentioned in git.

The AUTHORS file is mostly Chet Ramey with occasional input from other FSF members.


This article is plagiarized from the Rust Book: https://doc.rust-lang.org/stable/book/ch15-01-box.html


I don't think this is true in the general case. Most Solokeys come in a "locked" form-- they will only accept firmware updates that are signed by the manufacturer. You can buy a "hacker" variant that is unlocked (meant for those that want to tinker with the firmware), but if you were to use one of those you're giving up security against someone loading malicious firmware onto your device.

This is probably the right tradeoff for most users. Solokeys has done a great job of providing continuous support for all of their products, and their software stack has been open source since the beginning. That (combined with the low price) makes them my first choice for a hardware security token.


> You can buy a "hacker" variant that is unlocked (meant for those that want to tinker with the firmware), but if you were to use one of those you're giving up security against someone loading malicious firmware onto your device.

You can't set it to wipe when updated?


I have no firsthand information, but reading https://github.com/solokeys/solo

"Solo Hacker can be converted to a secure version, but normal Solo cannot be converted to a Hacker version."


I can confirm that on Sonic (resold AT&T) VDSL I am seeing this exact corruption.

Nice find! I had been wondering why I had been seeing odd TLS failure messages recently.


Sonic might be the best avenue to get this fixed. They care about their customers and presumably can talk with AT&T in a much more meaningful way.


For those that enjoy stories about the early days of electric guitar, I recommend picking up the book "The Birth of Loud: Leo Fender, Les Paul, and the Guitar-Pioneering Rivalry That Shaped Rock 'n' Roll" by Ian S. Port. It's a great story about the first electric guitars and their creators.


A Solo key is $20.

https://solokeys.com/


Note that the feature set on this is limited. Specifically it is missing GPG (and thus SSH) support. It may be added via a software update if the somu campaign goes very well. But frankly that is a long shot.

https://www.crowdsupply.com/solokeys/somu

Of course if you only need WebAuthn then solo keys are a great option.


https://quoteinvestigator.com/2017/03/23/same/

Not Einstein. It's a quote from a 1981 Narcotics Anonymous pamphlet.


Print it on a shirt, and you have the thing William Gibson dreamed up in "Zero History":

"What’s that?" she asked.

"The ugliest T-shirt in the world," he said… "So ugly that digital cameras forget they’ve seen it."


Was thinking the exact same thing.

Though I got the impression that it was a deliberate backdoor to allow security services to operate incognito, rather than an AI-fooling hack. Maybe just because the book was written before modern neural nets became so widespread.

A friend used to design systems for a major CCTV company. I asked him to add a similar backdoor for me, but sadly he never did...


Brilliant plot device. And like much of Gibson’s other plot devices, bourne out in due time.

Remember, the penultimate device in the novel was an antihero’s cornering the global marketplace order flow.


It's interesting that their ssh-agent runs as a service under an Administrator account. I'd guess this is an attempt to better protect the private key against theft during a local compromise (i.e. unlocked computer left running on your desk).

I haven't seen this done on Linux. Has this trick been implemented on other systems?



regarding "development job... putting me outside the income level":

I faced the same situation; after being rejected, all I had to do was file some extra paperwork ("special circumstances") saying that I'd left my job and no longer had any income.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: