News for hackers. Stuff that matters.
Re:Chrome 0-day exploit used in Operation WizardOpium by nicoburns on Saturday November 02, 2019 @07:20AM (#21427031)
But not in Rust. Go isn't exactly a bastion of safety. It's memory safe due to the GC, but it has a weak type system, so logic bugs are not well guarded against.
Re:Chrome 0-day exploit used in Operation WizardOpium by zozbot234 on Saturday November 02, 2019 @07:36AM (#21427071)
> It's memory safe due to the GC

That gets debatable as soon as you start using concurrency, like I said. There are idiomatic patterns in concurrent Go that are very much not safe.

Re:Chrome 0-day exploit used in Operation WizardOpium by MaxBarraclough on Saturday November 02, 2019 @04:02PM (#21429721)
What do you mean?

It has a GC, right? So use-after-free is impossible, no?

Re:Chrome 0-day exploit used in Operation WizardOpium by lima on Saturday November 02, 2019 @08:05AM (#21427171)
On the other hand, Go code is a lot easier to audit.

The kind of logic bug that the Rust compiler prevents due to stronger typing is typically a crash in Go, not a security issue.

Re:Chrome 0-day exploit used in Operation WizardOpium by nicoburns on Saturday November 02, 2019 @08:10AM (#21427191)
Disagree on this. In Rust I can read most of the information I need to know straight from the function signatures. In Go I have to go through every line of code (and there are often a lot of lines due to Go's lack of expressive power).
Re:Chrome 0-day exploit used in Operation WizardOpium by lima on Saturday November 02, 2019 @08:12AM (#21427200)
In Rust code I audit, I typically have to jump through multiple layers of abstraction and cleverness, while Go code is straight forward and boring.
Re:Chrome 0-day exploit used in Operation WizardOpium by nicoburns on Saturday November 02, 2019 @08:37AM (#21427296)
I guess it's a matter of preference. If something is abstracted, then you only have to audit it once (and often you can count on someone else having audited it). With Go code, everything is new and unique, so there are a lot more opportunities to introduce bugs.
Re:Chrome 0-day exploit used in Operation WizardOpium by Quekid5 on Saturday November 02, 2019 @11:20AM (#21428165)
Not to be argumentative, honestly, that sound pretty laughable if you don't have an equivalent of an algebraic effect system (or similar).

A "function" in Rust can do a whole bunch of stuff that is not signaled by its type signature.

Re:Chrome 0-day exploit used in Operation WizardOpium by nicoburns on Saturday November 02, 2019 @02:04PM (#21429074)
Mutability / immutability is in the function signatures, and that goes a long way. It's not as good as an effect system of course. But along with global variables barely being a thing in Rust, it goes a long way to cutting out the common course of bugs.
Re:Chrome 0-day exploit used in Operation WizardOpium by Thaxll on Saturday November 02, 2019 @10:33AM (#21427908)
Rust is not safer than Go, people thinking otherwise misunderstand borrow checker vs GC.

Furthermore you're talking about memory safety vs business logic bugs, two different things.

Re:Chrome 0-day exploit used in Operation WizardOpium by pcwalton on Saturday November 02, 2019 @11:05AM (#21428059)
Go is not memory-safe in the presence of concurrency. Interfaces and slices (i.e. fat pointers) are not written atomically, which can cause undefined behavior.

I haven't heard of this causing a problem in practice, though.

Re:Chrome 0-day exploit used in Operation WizardOpium by Thaxll on Saturday November 02, 2019 @11:18AM (#21428151)
I never heard undefined behavior in Go like your example. This would means that not synchronizing a slice would lead to memory corruption.

Please give us a code example.

Re:Chrome 0-day exploit used in Operation WizardOpium by psanford on Saturday November 02, 2019 @03:03PM (#21429360)
Here's a blog post from Russ Cox (Go core team) explaining it: https://research.swtch.com/gorace
Re:Chrome 0-day exploit used in Operation WizardOpium by staticassertion on Saturday November 02, 2019 @02:59PM (#21429341)
Here you go: https://blog.stalkr.net/2015/04/golang-data-races-to-break-m...

What's even worse is that Go code is not (outside of Linux/ some distros) compiled with ASLR.

Re:Chrome 0-day exploit used in Operation WizardOpium by pcwalton on Saturday November 02, 2019 @01:00PM (#21428718)
Yes, not synchronizing a slice can lead to memory corruption in Go.
Re:Chrome 0-day exploit used in Operation WizardOpium by skybrian on Saturday November 02, 2019 @12:01PM (#21428365)
Slice values are normally copied so it's not an issue. The slice would need to be stored in a global or a struct's field and then changed while some other goroutine is reading it.

(I haven't seen this happen, though.)

Re:Chrome 0-day exploit used in Operation WizardOpium by cwzwarich on Saturday November 02, 2019 @12:45PM (#21428639)
Are all Go fat pointers two words? If so, it would be pretty trivial to make them atomic on AArch64 using LDP/STP.
Re:Chrome 0-day exploit used in Operation WizardOpium by pcwalton on Saturday November 02, 2019 @12:55PM (#21428696)
Unfortunately slices are 3 words. (Besides, AArch64 isn't a common target for Go. On x86 you'd need cmpxchg16b or something.)