Live data from Hacker News

Memory Safe Languages in Android 13

security.googleblog.com

21–30 of 606 posts

Re: Memory Safe Languages in Android 13

#21
post #17

Not being aware of how vulnerabilities are detected and despite being a big fan of Rust, I wonder if there are other variables that drive down the ability to find bugs in the short term. If a researcher is only familiar with C and C++, is it possible that they're just ill equipped to find similar bugs in Rust?

There's definitely a learning curve for looking for vulns in Rust vs C/C++, especially compared to C. Exploitation in particular will be the trickier part, imo, since it requires not just understanding the vuln but also the context and reachability.

That said, there are a ton of ways that auditing for vulnerabilities is just as easy or way easier. In particular, most tooling for C/C++ can be applied to rust - fuzzers and sanitizers, for example. Additionally, one only has to "grep for unsafe" and work from there to find Rust vulns, which largely amounts to "what are the assertions for this unsafe block, are they complete, are they held?".

Re: Memory Safe Languages in Android 13

#22
post #17

Not being aware of how vulnerabilities are detected and despite being a big fan of Rust, I wonder if there are other variables that drive down the ability to find bugs in the short term. If a researcher is only familiar with C and C++, is it possible that they're just ill equipped to find similar bugs in Rust?

Not only that, they are also comparing new code with pretty old code.

Re: Memory Safe Languages in Android 13

#23

Glad to see robust work here. This strongly supports what should already be obvious, but sadly is not always understood; that memory safe languages are radically safer than memory unsafe languages. The impact is blatantly demonstrated here.

Rust (despite the common understanding) is not a memory-safe language in its entirety. It is a language designed to have a strict division of safe/unsafe which makes it easier for developers to compartmentalize code to achieve memory-safety.

No language in use meets your definition of memory safe.

Re: Memory Safe Languages in Android 13

#24
post #2

Nice: "it’s likely that using Rust has already prevented hundreds of vulnerabilities from reaching production"

The problem with Rust is the language syntax is ugly. It has a ton of visual noise.

I think folks who write languages should have a typographer on their team because something like this:

use std::collections::HashMap

Is a typographic nightmare. While I understand “form follows function”, it’s tough to be excited to program in something like this.

Re: Memory Safe Languages in Android 13

#25

Glad to see robust work here. This strongly supports what should already be obvious, but sadly is not always understood; that memory safe languages are radically safer than memory unsafe languages. The impact is blatantly demonstrated here.

Rust (despite the common understanding) is not a memory-safe language in its entirety. It is a language designed to have a strict division of safe/unsafe which makes it easier for developers to compartmentalize code to achieve memory-safety.

Is there any practical programming language that is memory safe in its "entirety"? Python, for example, certainly is not. It has unsafe escape hatches (via ffi, at the very least). Yet, everyone I know of says and thinks of Python as a memory safe language. I do as well.

> which makes it easier for developers to compartmentalize code to achieve memory-safety

The problem here is that this is incomplete. Many many many languages have achieved this before Rust. Where Rust is (somewhat although not entirely) unique is bringing this compartmentalization into a context that (mostly) lacks a runtime and garbage collection.

I have no problems calling Rust a "memory safe language" precisely because I have no problems calling Java or Python "memory safe languages." What matters isn't whether the language is "entirely" memory safe. What matters is what its default is. C and C++ are by default unsafe everywhere. Rust, Java, Python and many others are all safe by default everywhere. This notion is, IMO, synonymous with the more pithy "memory safe language."

Re: Memory Safe Languages in Android 13

#26
post #15

Earlier quoted context omitted.

>> Actually now is the time to learn C++. Amount of leverage and money C++ developers will be able to utilize is enormous, given how much critical code is written in it. The article states: "We continue to invest in tools to improve the safety of our C/C++. ... Vulnerabilities found using these tools contributed both to prevention of vulnerabilities in new code as well as vulnerabilities found in old code that are in…

I believe what the post you're replying to is implying is, there's a ton of C++ code in the world that isn't going to be ported to Rust, and someone is going to have to fix all of those bugs in C++ code already in the wild. So you can get paid to be that person.

>> there's a ton of C++ code in the world that isn't going to be ported to Rust, and someone is going to have to fix all of those bugs in C++ code already in the wild. So you can get paid to be that person.

That is well and good for legacy systems that cannot / will not be updated.

Android is not a legacy system and is adopting Rust and seeing security benefits.

Linux is not a legacy system and is slowly adopting Rust and may see greater use with time.

Time will tell, but so far the future is optimistic.

Re: Memory Safe Languages in Android 13

#27
post #2

Nice: "it’s likely that using Rust has already prevented hundreds of vulnerabilities from reaching production"

The problem with Rust is the language syntax is ugly. It has a ton of visual noise. I think folks who write languages should have a typographer on their team because something like this: use std::collections::HashMap Is a typographic nightmare. While I understand “form follows function”, it’s tough to be excited to program in something like this.

It seems unlikely that it's the double colons and the angle brackets that hold people back from migrating from C and C++ to Rust.

Re: Memory Safe Languages in Android 13

#28

I'll be downvoted for pointing out that comparing C++ with Rust without further context can be made into a false dichotomy. Some people are posting the article around the Internet as evidence that Rust solved security. Instead, there are many other memory safe languages around and there has been thousands in the past. Additionally, many security issues are not due to memory safety. Please keep that in mind when makin…

But I think other memory safe languages don't have C++-like performance, right?

Re: Memory Safe Languages in Android 13

#29

Glad to see robust work here. This strongly supports what should already be obvious, but sadly is not always understood; that memory safe languages are radically safer than memory unsafe languages. The impact is blatantly demonstrated here.

Rust (despite the common understanding) is not a memory-safe language in its entirety. It is a language designed to have a strict division of safe/unsafe which makes it easier for developers to compartmentalize code to achieve memory-safety.

Then even Java is not memory safe according to the implicit standard that you allude to here since one can use the `Unsafe` class.

Re: Memory Safe Languages in Android 13

#30
post #2

Nice: "it’s likely that using Rust has already prevented hundreds of vulnerabilities from reaching production"

The problem with Rust is the language syntax is ugly. It has a ton of visual noise. I think folks who write languages should have a typographer on their team because something like this: use std::collections::HashMap Is a typographic nightmare. While I understand “form follows function”, it’s tough to be excited to program in something like this.

I always say that if the strongest complaint people have about your language is syntax; you've already succeeded.
Post reply on HN