News for hackers. Stuff that matters.
Re:Chromium project finds that 70% of security defects are m... by fetbaffe on Sunday May 24, 2020 @06:11AM (#23290498)
Correct, that is true for any language where you deal with raw threads, managed or unmanaged. That tells us that we should avoid using raw threads and instead use some other API to achieve parallelism.
Re:Chromium project finds that 70% of security defects are m... by nicoburns on Sunday May 24, 2020 @09:04AM (#23291209)
It's not true in Rust. In Rust, objects cannot be concurrently accessed from multiple threads unless they are explicitly marked as thread-safe (with the Sync trait), or wrapped in a a Mutex, which ensures that the safety variants are upheld.
Re:Chromium project finds that 70% of security defects are m... by pjmlp on Monday May 25, 2020 @02:08AM (#23298415)
Yes for multi-threaded code, although not quite for multi-processes code, which is what one should be writing when the goal is security.

Then you are back into the same synchronization issues as in every other language.

Re:Chromium project finds that 70% of security defects are m... by vardump on Monday May 25, 2020 @05:28AM (#23299466)
Yeah, it solves only the 99.9% case.
Re:Chromium project finds that 70% of security defects are m... by pjmlp on Monday May 25, 2020 @08:24AM (#23300263)
So Firefox will return to be a single executable after Rust migration is fully done? After all that is not needed it seems.
Re:Chromium project finds that 70% of security defects are m... by fetbaffe on Sunday May 24, 2020 @10:59AM (#23291946)
Rust does not compile if you don't use the techniques you described?
Re:Chromium project finds that 70% of security defects are m... by ansible on Sunday May 24, 2020 @11:19AM (#23292095)
> Rust does not compile if you don't use the techniques you described?

Yes, exactly.

https://kkimdev.github.io/posts/2019/04/22/Rust-Compile-Time...

Of course, you can bypass this by using 'unsafe' code, where you are explicitly telling the compiler that you have manually verified Rust's safety guarantees.

This is why a significant portion of Rust's community gets agitated with (possibly unnecessary) use of 'unsafe' in popular libraries.

Re:Chromium project finds that 70% of security defects are m... by fetbaffe on Sunday May 24, 2020 @11:50AM (#23292348)
Then I stand corrected and applaud the creators of Rust for haven taken these measures for writing thread safe code, because it is supereasy to get threading wrong, even for the most experienced developer.
Re:Chromium project finds that 70% of security defects are m... by littlestymaar on Sunday May 24, 2020 @01:17PM (#23292971)
Interestingly enough, this was the raison d'être of the Rust project at the beginning, while zero-cost abstraction and memory-safety without GC (and the borrow-checker) weren't part if the initial goal. When Rust was first released as a research project it had green threads and a GC (interestingly close to Go actually), but it was already designed with data-race freedom in mind.
Re:Chromium project finds that 70% of security defects are m... by thePunisher on Sunday May 24, 2020 @12:56PM (#23292812)
Both Java and C# are designed for memory-safety but not thread-safety; Rust is.

Considering many of the software problems we face have some connection to thread-safety, Rust is the way to go.

Re:Chromium project finds that 70% of security defects are m... by pjmlp on Wednesday May 27, 2020 @03:50AM (#23320509)
I would consider that the way to go is multi-processes instead, and secure every critical module on their own OS sandbox.

Threading seemed a good idea that went wrong.

Re:Chromium project finds that 70% of security defects are m... by ReactiveJelly on Sunday May 24, 2020 @10:52AM (#23291901)
And in the last quadrant, you can use non-raw threads like the Task or Parallel APIs and still have threading issues in C#.

I'm trying to learn Android and some libraries give zero indication of what thread your callbacks will be called on.

Maybe there's a convention somewhere that says "On Android, you can't assume anything about callbacks, so always assume you're on some anonymous worker thread and lock everything or dispatch to a thread you own"

But I have not come across it yet.

Re:Chromium project finds that 70% of security defects are m... by pjmlp on Monday May 25, 2020 @02:12AM (#23298445)
Yes that is the convention.

You cannot assume anything about process or thread lifetimes on Android, as the simple act of rotating the screen will restart your application, and it can be killed at any moment and restarted later, due to memory pressure, or because the use has switched applications.

So whatever was the state of your application can be completely different when the callback is supposed to be invoked later on.