zlacker

[parent] [thread] 30 comments
1. ddalci+(OP)[view] [source] 2021-07-20 21:48:47
What’s with the backlash against Rust? It literally is “just another language”. It’s not the best tool for every job, but it happens to be exceptionally good at this kind of problem. Don’t you think it’s a good thing to use the right tool for the job?
replies(3): >>crater+L >>ameliu+b4 >>zo1+Hb1
2. crater+L[view] [source] 2021-07-20 21:54:03
>>ddalci+(OP)
> What’s with the backlash against Rust?

What's with the hyping of Rust as the Holy Grail as the solution to everything not including P=NP and The Halting Problem?

replies(1): >>pdimit+G2
◧◩
3. pdimit+G2[view] [source] [discussion] 2021-07-20 22:10:07
>>crater+L
No serious and good programmer is hyping Rust as the "Holy Grail". You are seeing things due to an obvious negative bias. Link me 100x HN comments proving your point if you like but they still mean nothing. I've worked with Rust devs for a few years and all were extremely grounded and practical people who arrived at working with it after a thorough analysis of the merits of a number of technologies. No evangelizing to be found.

Most security bugs/holes have been related to buffer [over|under]flows. Statistically speaking, it makes sense to use a language that eliminates those bugs by the mere virtue of the program compiling. Do you disagree with that?

replies(2): >>tptace+b3 >>maqp+y4
◧◩◪
4. tptace+b3[view] [source] [discussion] 2021-07-20 22:13:47
>>pdimit+G2
Nobody seriously thinks it's "Rust" that's the silver bullet either; they just believe memory-safe languages are. There are a bunch of them to choose from. We hear about Rust because it works in a bunch of high-profile cases that other languages have problems with, but there's no reason the entire iMessage stack couldn't have been written in Swift.
replies(4): >>pdimit+w3 >>static+A3 >>tialar+Xb >>option+rk
◧◩◪◨
5. pdimit+w3[view] [source] [discussion] 2021-07-20 22:16:39
>>tptace+b3
Agreed. I was simply mostly addressing this person's obvious beef with Rust.
◧◩◪◨
6. static+A3[view] [source] [discussion] 2021-07-20 22:17:13
>>tptace+b3
Totally. I said Rust because I write Rust. Like, that's (part of) my job. Rust is no more memory safe (to my knowledge) than Swift, Java, C#, etc.

I also said "way, way less" not "not at all". I still think about memory safety in our Rust programs, I just don't allocate time to address it (today) specifically.

replies(2): >>noizej+4e >>paavoh+8O
7. ameliu+b4[view] [source] 2021-07-20 22:21:50
>>ddalci+(OP)
It is good to keep in mind that the Rust language still has lots of trade-offs. Security is only one aspect addressed by Rust (another is speed), and hence it is not the most "secure" language.

For example, in garbage collected languages the programmer does not need to think about memory management all the time, and therefore they can think more about security issues. Rust's typesystem, on the other hand, can really get in the way and make code more opaque and more difficult to understand. And this can be problematic even if Rust solves every security bug in the class of (for instance) buffer overflows.

If you want secure, better use a suitable GC'ed language. If you want fast and reasonably secure, then you could use Rust.

replies(3): >>tptace+q6 >>static+67 >>tialar+1y
◧◩◪
8. maqp+y4[view] [source] [discussion] 2021-07-20 22:25:20
>>pdimit+G2
I like what tptacek wrote in the sibling comment. IIUC Rust keeps getting mentioned as "the" memory-safe language because it's generally equally fast compared to C programs. And it's mainly C and C++ that are memory-unsafe. So Rust is good language to combat the argument of speed (that's often interchangeable with profits in business world, especially if security issues have a flat rate of cyber insurance).
◧◩
9. tptace+q6[view] [source] [discussion] 2021-07-20 22:42:51
>>ameliu+b4
I don't think this is a good take. Go, Java, Rust, Python, Swift; they all basically eliminate the bug class we're talking about. The rest is ergonomics, which are subjective.

"Don't use Rust because it is GC'd" is a take that I think basically nobody working on memory safety (either as a platform concern or as a general software engineering concern) would agree with.

◧◩
10. static+67[view] [source] [discussion] 2021-07-20 22:47:16
>>ameliu+b4
> Rust's typesystem, on the other hand, can really get in the way and make code more opaque and more difficult to understand.

I don't disagree with the premise of your post, which is that time spent on X takes away from time spent on security. I'll just say that I have not had the experience, as a professional rust engineer for a few years now, that Rust slows me down at all compared to GC'd languages. Not even a little.

In fact, I regret not choosing Rust for more of our product, because the productivity benefits are massive. Our rust code is radically more stable, better instrumented, better tested, easier to work with, etc.

◧◩◪◨
11. tialar+Xb[view] [source] [discussion] 2021-07-20 23:37:32
>>tptace+b3
Fair. Two further thoughts:

1. Rust also has other safety features that may be relevant to your interests. It is Data Race Free. If your existing safe-but-slow language offers concurrency (and it might not) it almost certainly just tells you that all bets are off if you have a Data Race, which means complicated concurrent programs exhibit mysterious hard-to-debug issues -- and that puts you off choosing concurrency unless it's a need-to-have for a project. But with Data Race Freedom this doesn't happen. Your concurrent Rust programs just have normal bugs that don't hurt your brain when you think about them, so you feel free to pick "concurrency" as a feature any time it helps.

2. The big surface area of iMessage is partly driven by Parsing Untrusted File Formats. You could decide to rewrite everything in Rust, or, more plausibly, Swift. But this is the exact problem WUFFS is intended to solve.

WUFFS is narrowly targeted at explaining safely how to parse Untrusted File Formats. It makes Rust look positively care free. You say this byte from the format is an 8-bit unsigned integer? OK. And you want to add it to this other byte that's an 8-bit unsigned integer? You need to sit down and patiently explain to WUFFS whether you understand the result should be a 16-bit unsigned integer, or whether you mean for this to wrap around modulo 256, or if you actually are promising that the sum is never greater than 255.

WUFFS isn't in the same "market" as Rust, its "Hello, world." program doesn't even print Hello, World. Because it can't. Why would parsing an Untrusted File Format ever do that? It shouldn't, so WUFFS can't. That's the philosophy iMessage or similar apps need for this problem. NSO up against WUFFS instead of whatever an intern cooked up in C last week to parse the latest "must have" format would be a very different story.

◧◩◪◨⬒
12. noizej+4e[view] [source] [discussion] 2021-07-20 23:54:37
>>static+A3
If you would have mentioned those other languages in your original post, it might have amplified your valuable and important point even better, rather than triggering some readers effectively accusing you of shilling.

I don’t mean this in a very critical spirit, though.

Communication is really hard - especially in a large setting where not everyone reads you in the same context, and not everyone means well.

On balance, you post was valuable to me!

replies(1): >>static+De
◧◩◪◨⬒⬓
13. static+De[view] [source] [discussion] 2021-07-21 00:00:23
>>noizej+4e
I mentioned Rust because I write Rust professionally. If I wrote Java professionally, as I used to, I would have said "java". So you're probably correct that I could preempt stupid people's posts, but I don't care about the dregs of HN reading into my very clear, simple statement, just because they're upset about rust or whatever. It's just not worth it to me.

I'm glad the post was of value to you. The talk is really good and I think more people should read it.

replies(1): >>noizej+7g
◧◩◪◨⬒⬓⬔
14. noizej+7g[view] [source] [discussion] 2021-07-21 00:15:45
>>static+De
I hear you, and it’s your prerogative to choose how much to invest in reducing the attack surface for your communication.

On the other hand, you could choose to think about communications in an analogous way to your code, both being subject to attack by bad actors trying to subvert your good intentions.

So, the argument could be made, that removing attack surface from communication is analogous to hardening your code.

I also come from a coding background (albeit a long time ago) and with the help of some well meaning bosses over time eventually came to realize, that my messages could gain more influence, by reducing unnecessary attack surface. - Doesn’t mean I always get it right, even now - but I am aware and generally try hard to do just that.

replies(2): >>static+Br >>pdimit+pY
◧◩◪◨
15. option+rk[view] [source] [discussion] 2021-07-21 00:58:30
>>tptace+b3
It also doesn't help that Rust has this addictive nature and once you tasted your first major Rust program and tamed the borrow checker, you will want to keep using it everywhere. And that's the reason why people keep looking around to rewrite something in Rust. It's in the same category as any other banned drug :)
replies(1): >>tptace+Fw
◧◩◪◨⬒⬓⬔⧯
16. static+Br[view] [source] [discussion] 2021-07-21 02:07:23
>>noizej+7g
Yep, I definitely get what you're saying and strategic communication is totally worthwhile (I'm a CEO, the value is absolutely not lost on me). It's just not something I prioritize on HN, that's just the personal call I make.
replies(1): >>noizej+BD
◧◩◪◨⬒
17. tptace+Fw[view] [source] [discussion] 2021-07-21 02:56:24
>>option+rk
That has not been my experience.
◧◩
18. tialar+1y[view] [source] [discussion] 2021-07-21 03:10:25
>>ameliu+b4
A thing to remember about GC is that it solves only one very important resource. Memory.

If your program loses track of which file handles are open, which database transactions are committed, which network sockets are connected, GC does not help you at all for those resources, when you are low on heap the system automatically looks for some garbage to get rid of, but when you are low on network sockets, the best it could try is hope that cleaning up garbage disconnects some of them for you.

Rust's lifetime tracking doesn't care why we are tracking the lifetime of each object. Maybe it just uses heap memory, but maybe it's a database transaction or a network socket. Either way though, at lifetime expiry it gets dropped, and that's where the resource gets cleaned up.

There are objects where that isn't good enough, but the vast majority of cases, and far more than under a GC, are solved by Rust's Drop trait.

replies(2): >>valent+EB >>kaba0+NW
◧◩◪
19. valent+EB[view] [source] [discussion] 2021-07-21 03:57:11
>>tialar+1y
It's not like Rust were the only or even the best language in solving the problems you mentioned. It might be the best performance focused / low-level language though.
replies(1): >>vanvie+fq1
◧◩◪◨⬒⬓⬔⧯▣
20. noizej+BD[view] [source] [discussion] 2021-07-21 04:19:23
>>static+Br
fair enough! :-)
◧◩◪◨⬒
21. paavoh+8O[view] [source] [discussion] 2021-07-21 06:24:01
>>static+A3
If we include data race safety in the definition of memory safety (which it ultimately is), then Rust is safer than any commonly used garbage collected language with access to multithreading, including Swift, Java and C#.
replies(1): >>tptace+nQ
◧◩◪◨⬒⬓
22. tptace+nQ[view] [source] [discussion] 2021-07-21 06:50:59
>>paavoh+8O
This is a RESF trope. We do not include Rust's notion of data race safety in the definition of memory safety as it is used in security. Not all bugs are created equal.
◧◩◪
23. kaba0+NW[view] [source] [discussion] 2021-07-21 07:45:40
>>tialar+1y
High-level languages can provide abstractions though that can manage object life cycles to a degree for you, for example dependency injection frameworks, like Spring.

Not disagreeing, just mentioning.

replies(1): >>juki+Wk1
◧◩◪◨⬒⬓⬔⧯
24. pdimit+pY[view] [source] [discussion] 2021-07-21 07:58:00
>>noizej+7g
> So, the argument could be made, that removing attack surface from communication is analogous to hardening your code.

That's true, but this is one of the cases where obtaining the last 5-10% of clarify might require 90% of the total effort.

Now whether one actually already has plucked all the low-hanging fruit in their own communication and if it's already good -- that's a separate discussion.

25. zo1+Hb1[view] [source] 2021-07-21 10:22:15
>>ddalci+(OP)
It's unusually or suspiciously "hyped". Not to the extent as the other sibling exaggerated to, but enough for it to be noticeable and to rub people the wrong way, myself included. It rubs me the wrong way because something feels off about the way it's hyped/pushed/promoted. It's like the new javascript in the programming world. And if we allow it (like we did with JS), it'll overtake way too much mindshare with the unfortunate detriment and neglect of all others.
◧◩◪◨
26. juki+Wk1[view] [source] [discussion] 2021-07-21 11:42:24
>>kaba0+NW
And many languages also provide convenient syntax for acquiring and releasing a resource for a dynamic extent (Java try-with-resources, C# `using`, Python `with`, etc.), which cover the majority of use cases.
replies(1): >>fauige+qX1
◧◩◪◨
27. vanvie+fq1[view] [source] [discussion] 2021-07-21 12:21:48
>>valent+EB
It's not the best language for solving this type of problems? What (kind of) language would you say is even better for that?
replies(2): >>rurban+aL4 >>valent+jd7
◧◩◪◨⬒
28. fauige+qX1[view] [source] [discussion] 2021-07-21 15:10:59
>>juki+Wk1
Yes, but these features are usually optional. Library users can easily forget to use them and neither library authors nor the compiler can do anything to enforce it.

The brilliant thing about RAAI style resource management is that library authors can define what happens at the end of an object's lifetime and the Rust compiler enforces the use of lifetimes.

replies(1): >>jolux+Vv3
◧◩◪◨⬒⬓
29. jolux+Vv3[view] [source] [discussion] 2021-07-21 23:13:56
>>fauige+qX1
I agree that RAII is superior, but it’s not true that compilers and library authors can’t do anything to enforce proper usage of Drop-able types in GC’d languages. C# has compiler extensions that verify IDisposables are used with the using statement, for example. Granted, this becomes a problem once you start writing functions that pass around disposable types.
◧◩◪◨⬒
30. rurban+aL4[view] [source] [discussion] 2021-07-22 12:37:44
>>vanvie+fq1
Actually safe languages fOR example. Pony guarantees all three safeties, memory, type and concurrency, whilst in Rust it's only a plan, just not implementated. Stack overflows, type unsafety, dead locks. POSIX compatible stdlib.

Concurrent Pascal or Singularity also fit the bill, with actual operating systems being written in it.

◧◩◪◨⬒
31. valent+jd7[view] [source] [discussion] 2021-07-23 05:36:43
>>vanvie+fq1
Any language that offers some kind of effect system that has support for brackets and cancelation, for example Haskell or Scala.

There isn't even specific language support necessary, it's on the library level.

[go to top]