Live data from Hacker News

Rewrite Everything in Rust

robert.ocallahan.org

31–40 of 242 posts

Re: Rewrite Everything in Rust

#32

Earlier quoted context omitted.

> A rewrite would clean up the code, sure, but then you're left in the same situation, only with brand new bugs that nobody has time to fix. The entire point is that you're not in the same situation regarding memory safety problems/vulnerabilities.

Memory safety problems are the low-hanging fruit of vulnerabilities. A re-write by unskilled programmers will not guarantee the code is safe, because they will introduce many other kinds of vulnerabilities.

Nobody is claiming that Rust prevents all security vulnerabilities. The claim is that memory safety problems are severe enough that a rewrite is justified.

(Incidentally, there are other classes of vulnerabilities that Rust and/or its libraries heavily mitigate, such as deserialization issues along the lines of the Rails YAML bug.)

Re: Rewrite Everything in Rust

#33

Earlier quoted context omitted.

> A rewrite would clean up the code, sure, but then you're left in the same situation, only with brand new bugs that nobody has time to fix. The entire point is that you're not in the same situation regarding memory safety problems/vulnerabilities.

Memory safety problems are the low-hanging fruit of vulnerabilities. A re-write by unskilled programmers will not guarantee the code is safe, because they will introduce many other kinds of vulnerabilities.

Are we still talking about libc here?

Re: Rewrite Everything in Rust

#34

If a given piece of software has been largely written using certain patterns or conventions, then it is often possible for a syntactic rewrite engine to be able to match those patterns, then output idiomatic code patterns in the target language. This may well be applicable to kernels and other constituents of an OS.

Isn't that just what a compiler is, where the target language is machine code?

I realize something like glibc would be the LAST set of source code to run through a transpiler, but how hard do folks think it would be to make a C -> Rust transpiler? I'd think you'd go about it by making Rust a target backend for LLVM. This way you let LLVM deal with the all C stuff (macros, etc), and just focus on the internal representation to Rust conversion. In theory, you'd get C++ to Rust as well.

Chances is successfully going from some not-so-obfuscated C code to equally not-so-obfuscated Rust code?

Re: Rewrite Everything in Rust

#35
post #9

I think this misses the real problem. So many pieces of foundational software like glibc and OpenSSL are understaffed, underfunded, and plagued by terrible code. Go read glibc getaddrinfo: it's a mess! Rewriting the software in Rust would not solve these problems any more than rewriting it in C++ would. A rewrite would clean up the code, sure, but then you're left in the same situation, only with brand new bugs that…

This is why I personally think the OSS community should be more encouraging of "salary" style funding. There is a loud, poisonous minority of advocates that seem to think that asking for money is just plain evil. That attitude is a material disservice to OSS in general: it makes OSS weaker and less capable, for the sake of some weird puritan reflex. N.B.: I have never and will never ask for, nor accept any income fro…

Do people think companies would pay for a closed-source glibc if it were shown to be 100% compatible with the current glibc, but written in Rust?

Re: Rewrite Everything in Rust

#36
post #9

I think this misses the real problem. So many pieces of foundational software like glibc and OpenSSL are understaffed, underfunded, and plagued by terrible code. Go read glibc getaddrinfo: it's a mess! Rewriting the software in Rust would not solve these problems any more than rewriting it in C++ would. A rewrite would clean up the code, sure, but then you're left in the same situation, only with brand new bugs that…

This is why I personally think the OSS community should be more encouraging of "salary" style funding. There is a loud, poisonous minority of advocates that seem to think that asking for money is just plain evil. That attitude is a material disservice to OSS in general: it makes OSS weaker and less capable, for the sake of some weird puritan reflex. N.B.: I have never and will never ask for, nor accept any income fro…

[deleted]

Re: Rewrite Everything in Rust

#37
Not this crap again. C libraries are not pretty but they have been out there for decades, they have been reviewed and used in production.

There is no silver bullet, just because you use Rust it doesn't mean your programs will be completely safe.

A lot of these C libraries were written in more innocent times where a small bug would not affect as many people as it would today.

We live in a C world and I don't see that changing any time soon.

Re: Rewrite Everything in Rust

#38
post #19

Is there a "glibrust" or equivalent standard library for Rust, yet?

Rust of course has a standard library[0] and it includes a libc, but (I might be wrong here) I think the libc portion is FFI into glibc or similar. I think the stuff written in rust is considerably more high-level, focusing more on data structures, concurrency, string manipulation, etc. [0]: https://doc.rust-lang.org/std/

[deleted]

Re: Rewrite Everything in Rust

#39
post #30

1: So a new generation, new rewrite of everything... Then hitting brand new problems (sometimes old ones avoided by previous designs) not foreseen by majority. A new language spawns with the coming of a new generation, addressing some of these problems. Rewrites everything. Hits another set of problems. Goto 1.

Iteration is not bad.

Iteration without progress is bad.

Which one do you think would happen?

Re: Rewrite Everything in Rust

#40
post #7

How practical is rust for small processor IoT applications? Like the ESP8266 we saw recently? https://news.ycombinator.com/item?id=11148129 They often have horrible security, but are very small programs when you use them as wifi temperature sensors or similar. They are good targets for rewrites and greenfield applications. Right now it seems like ardunio C++ or some scripting language is the target.

I can't say how practical, but folks are working on it, as seen here: http://zinc.rs/
Post reply on HN