64 points · by masklinn · 7y ago · 79 comments
I really have to dispute this, these tools are not simple to use. You'll probably have a far easier time rewriting the code piecemeal, i.e. function-by-function (which will involve a lot of unsafety initially, since you're not using the idiomatic global patterns of a memory-safe language!) and then refactoring into something idiomatic for the language you're using. Projects like Firefox are basically taking a similar approach, only "rewriting" small portions of the codebase that can be deployed immediately once rewritten.
Where similar tools might be useful is for preventing logic-related issues that are not encompassed under simple memory safety. Unfortunately it's still not possible to endow, e.g. Rust code with automatically-checkable proofs, showing that the logic in the code preserves some appropriate conditions/invariants; while this is feasible, e.g. in Agda or Idris. Hopefully by the time these concerns become pressing, practical memory-safe languages will also offer this.
Proof left as an exercise for the reader, maybe? Seriously, UB is a very, very pernicious problem and without a formal specification of C/C++ and a machine-checked proof that this analysis is sound and complete, I am not going to believe it. The academic research community still regards this as an unsolved problem.
(It's a shame, too. With UB, we did this to ourselves.)
And software with many individual components can be gradually rewritten. Firefox is starting to use components written in Rust like Stylo and WebRender. Mozilla has an Oxidation project for bringing more Rust-based components to Firefox:
According to Herb Sutter's question to the audience a couple of years ago at CppCon, JetBrains and ISO C++ surveys, developers and corporations that actually care about static analysis tooling are the exception and not the norm.
I think the author has this backwards. Distributions don't play language favourites[1], and distributions like Debian celebrate the packaging of alternatives to give users choice. The author is right in observing that most C code is shipped by distributions and not elsewhere for packaging reasons, but then later inverts the causal relation.
If good replacements for components [that are currently] written in C appear, then distributions will package them, and the author's problem will go away.
[1] Except that distributions dislike toolchains that embed libraries into builds instead of dynamically linking them, since then they can't issue a security update for a library just by updating that library; a world rebuild is required. This isn't a language or safety issue though, and could easily be changed without changing the language. For example, gcc's golang implementation supports shared libraries now.
The GNU project used to have a manifesto page from the early days stating that C should be the preferred language to deliver GNU software, except in cases where it did not made sense like libraries for other languages, followed with a list of endorsed alternative languages.
Regarding safety it never made sense. Morris worm is now around 30 years old and lint was designed in 1979, with the expectation that every C developer would actually use it.
[1] perhaps the intended meaning of the title was "fuzzing shows that memory-unsafe languages are untenable", but that's certainly not the meaning of the current title
> perhaps the intended meaning of the title was "fuzzing shows that memory-unsafe languages are untenable", but that's certainly not the meaning of the current title
No, fuzzing makes these languages untenable because it provides a tool for automating memory unsafety issues. Without mature fuzzing tools, most of these issues can remain unfound, but fuzzing surfaces them — and their potential for exploitation — rather easily.
It's a bit of a "security by obscurity" thing, but I think there's a point to this view: fuzzing takes the existing crack / fault of memory unsafety[0] and blasts it open so wide you can get a truck through.
<Pointy-haired Boss>Fuzzing is now forbidden in our offices. Next problem?</phb>
It could be seen as a form of editorializing though, so it could be argued that it should be changed to the original just based on that.
FWIW it's the title / tagline the author themselves used when they posted the article on twitter, and I thought it was much clearer than the "official" title of "Fuzz rising".
Indeed. I prefer this title over "Fuzz rising" as well.
It's not a conclusion I'd end up with, but after a moment of thought, I agree with it.
The Color similarity is problematic indeed though.
1. Sort quantities in both the list and the chart by descending proportion. 2. Assign colors systematically, e.g a spectrum from red to purple, or shades of primary colors (bonus if you pick better colors for certain types of color blindness).
Are any distributions moving in this direction yet? Seems to me like C/C++ applications are so foundational to Linux that this would be a huge undertaking. Are there even any memory safe window managers? Hell, even then you're reliant on X or Wayland. PulseAudio/Alsa are also hard to replace.
edit: Quick google search only gives me https://github.com/mesalock-linux/mesalock-distro which is trying to replace common tools with Rust/Go counterparts. I'm not sure how active it is. The main repo only has one main contributor.
https://sawfish.tuxfamily.org/
As for userspace in Go, check https://github.com/gokrazy.
Google has a couple of talks with it.
Rust, Golang? Any other true contenders?
If you mean things like foundational libraries & network stacks, then go is not a contender[0]. If you mean system daemons and the like, then languages like ocaml, D, … should also work (and that's assuming you want / need the performance of a native binary, if you don't then the world's your oyster).
[0] to my understanding — and I may be completely mistaken here — memory-safe ADA with dynamic allocation and without GC is pretty much an active research field so fails either "memory safe" or "suitable for going fast"
Having made this experience, I doubt that conservative GC can ever be declared safe, unlike completely precise GC.
Why would D with a conservative collector be "more efficient"? How does being conservative (with stack roots, presumably) fundamentally make a GC better?
Why would OCaml be better than Go? OCaml is garbage-collected, no opting out.
It wouldn't? The footnote was for Ada's applicability in the context of "foundational libraries & network stacks" (as it's often advertised as a very safe yet low-level language), because in my understanding (and again I could be wrong here) it's either GC'd and memory-safe or neither, so same as e.g. D, making it unsuitable for that layer.
> Why would OCaml be better than Go? OCaml is garbage-collected, no opting out.
It wouldn't either? The "also" is the second clause indicates that Go would be suitable for "systems daemons and the like", and so would pretty much any other memory-safe language, possibly restricted to the more efficient ones (non-interpreted / JITed) depending on the specific use-case.
Fuchsia's IO volumne management and TCP/IP stack is written in Go.
ChromeOS hypervisor (gVisor) and Android GPU debugger (GAPI) are written in Go.
Does that have any affect on OpenJDK?
> Memory unsafe languages are not going to get better, or safe. It is time to move on.
and this is based on an entire article making the case that fuzzing is what reveals the vulnerabilities, and thus both shows and makes memory-unsafe languages untenable: fuzzing by white hats reveals how full of holes these programs are, but fuzzing by black hats shows them what has exploit potential in a much more significant and systematic manner than manual exploit research.
https://news.ycombinator.com/submit
It is not like everyone is aware of some magical comment describing the HN submission rules.
On what is usually a very strict patch review process, with kernel sanitizers and yet....
> the safety argument just doesn't carry as much weight for kernel developers, not because the safety argument isn't really, really important. It's just because it's safe, because when it's not safe, it blows up, and everyone gets really upset. We figure out why. We fix it. And we develop a lot of great tooling to not have these problems.