News for hackers. Stuff that matters.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by geofft on Tuesday October 04, 2016 @10:56PM (#12641266)
The smug replies on this comment seem to be the ones saying "Don't tell me about Rust".

So, then, why do you think that "We need to rewrite everything in Rust" isn't doing something productive? I've been a C++ and C developer for a long time and have been waiting for some safer language that lets me do what I've been doing in those languages. Knowing that Rust was a realistic option was what inspired me to learn it and write new things in it. If that happens at scale, that's how we actually get things written in a memory-safe language.

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by sirtaj on Wednesday October 05, 2016 @12:58AM (#12641640)
> So, then, why do you think that "We need to rewrite everything in Rust" isn't doing something productive?

The Linux kernel didn't get written because people on a forum said "we need to write a complete open source reimplementation of the UNIX kernel," but because Torvalds just went ahead and wrote it. Most things in F/OSS work that way.

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by geofft on Wednesday October 05, 2016 @01:12AM (#12641684)
GNU had a whole manifesto, though. https://www.gnu.org/gnu/manifesto.en.html (Although, yes, a signifiant body of software existed when the manifesto was published.)
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by Natsu on Wednesday October 05, 2016 @02:39AM (#12641940)
Linus Benedict Torvalds 8/25/91

Hello everybody out there using minix -

I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready.

https://groups.google.com/forum/#!msg/comp.os.minix/dlNtH7RR...

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by falcolas on Wednesday October 05, 2016 @09:52AM (#12643770)
I imagine the project is big enough now that anyone who would undertake it would want to be compensated for it. And since that is unlikely to ever pass the cost/benefit ratio for any given corporation, it's unlikely to happen. Not to mention the potential for alienating of the entire existing kernel development group.

It would be much easier to submit patches to slowly upgrade the kernel to a memory safe language, but that would require a lot of political savvy to push through, also making it an unlikely path to be taken. Ultimately, you'd have to convince Linus of the merits, and we all know how much he likes complex languages.

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by falcolas on Wednesday October 05, 2016 @09:19AM (#12643534)
If it hasn't happened already, with another of the dozens of memory safe languages (like ada) which have been on the market for dozens of years, another memory safe language coming (like Rust) along won't change that.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by geofft on Wednesday October 05, 2016 @12:23PM (#12645276)
Why do you think that? Or, put another way, why specifically do you think it didn't happen with previous memory-safe languages?

For one, Rust is a different language from the other memory-safe languages that have existed in the past, and in fact incorporates a lot of research in programming languages that didn't exist when Ada was designed. But even if that weren't true, one thing that's changed since the past is we now are slowly understanding how difficult it is to write secure software in C, and how important it is to write secure software. When Unix was first designed we (the entire programming community) didn't know about a lot of security issues, and the lack of Internet meant that it was less important to defend against them. It is probably much more worth rewriting our tools in Ada today than it was ten or twenty or thirty years ago.

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by falcolas on Wednesday October 05, 2016 @01:32PM (#12645903)
> Or, put another way, why specifically do you think it didn't happen with previous memory-safe languages?

IMO, because it's harder to break the rules. Sometimes the rules just need to be broken. There was a recent article about someone attempting to interface with OpenGL in Rust a month or so ago, and it discussed how they ended up giving up, since the things they needed to do didn't mesh well with how Rust expected programs to be written. If interfacing with a driver is so hard, how will interfacing with hardware be easier?

Programming for hardware requires a lot of breaking and bending the rules. How can being memory safe help when you're creating memory spaces as most software knows of it?

Performance is King, low memory overhead is Queen. Even rust can't take those thrones away from C. Not yet, at least. Perhaps not ever (I expect that C++ would have done it, were it possible for a language with the complexity of Rust).

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by steveklabnik on Wednesday October 05, 2016 @01:41PM (#12645994)

  >  If interfacing with a driver is so hard, how will interfacing with
  > hardware be easier?
It really depends. The key is to identify the proper ways to make the abstraction as safe as possible. This is a fairly new skill, in a new language. Said post was good, and the author has been using Rust for a long time, but one person failing to do so doesn't mean that it's impossible.

I'm still a noob at this kind of thing myself, but I recently wrote a (tiny) driver for a memory-mapped device. My first iteration had tons of unsafe code. My second iteration had three lines of unsafe code. My latest iteration has zero unsafe code, though you do need one call to an unsafe function outside of it in order to construct it. (to create a slice from the raw memory location that's mapped.)

That is, of course, pretty much the simplest possible case. But I believe the pattern will hold, over time, as people learn how to do it.

  > Even rust can't take those thrones away from C.
Rust is faster than C on some microbenchmarks. We'll see what the future holds.