News for hackers. Stuff that matters.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by IgorPartola on Tuesday October 04, 2016 @08:00PM (#12640645)
Obligatory comment so nobody else has to: C is a terrible language for security and we must abandon it immediately. Anyone that uses it has clearly not heard of Go/Rust/Haskell. We should just abandon the Linux kernel and start from scratch. And we can unit test the shit out of it to avoid security vulnerabilities. Hasn't Heartbleed taught us anything? MongoDB is web scale. Ron Paul 2012.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by nine_k on Tuesday October 04, 2016 @09:32PM (#12641019)
Go, unlikely. It's safer but it has other problems. Haskell is great but it's runtime makes it hard (though not impossible) to use in kernel development.

Rust and ATS seem to be pretty well suited. With Rust getting more and more traction, maybe not all is lost :)

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by smsm42 on Tuesday October 04, 2016 @09:43PM (#12641055)
I have extremely hard time believing there can be a viable OS kernel project on Haskell. I mean, yeah, you probably can write OS kernel in Haskell, if you are determined enough. But I don't believe you can make it into a viable project. Rust - maybe, if you can get enough mindshare. Which is also a big if so far...
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by cvwright on Wednesday October 05, 2016 @12:53AM (#12641621)
> I mean, yeah, you probably can write OS kernel in Haskell, if you are determined enough.

Some of my colleagues did, a few years ago.

http://jfla.inria.fr/2007/actes/Presentation/tolmach.pdf

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by johncolanduoni on Tuesday October 04, 2016 @11:36PM (#12641383)
If you plan on writing your OS in Haskell in the usual sense (i.e. your OS executes pure Haskell functions and interprets some sort of IO monad) you're going to end up implementing a full microkernel in another language just to get started. Not to mention it'll be a microkernel with a GC.

The only way I could see a kernel being truly written in Haskell is in a DSL something like atom[1]. Atom is an EDSL represents code that not only doesn't need a garbage collector, but also has a verified constant bound on memory usage. However if that's what you're looking for, you might as well go with an EDSL in a dependently typed language like Idris to make verification easier and extensible.

[1]: https://hackage.haskell.org/package/atom

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by bluejekyll on Tuesday October 04, 2016 @10:25PM (#12641184)
I think Rust has the mindshare, what it needs is people actually doing it.

Redox is a ground up OS, but I wonder if we shouldn't instead be taking more of an Oxidization approach where we rewrite more and more pieces of an existing OS in Rust piecemeal. This would add some overhead (programmatically not instructionwise) of a lot of context switches though between the C and the Rust code, which is to say it would be a little ugly for a while.

It might be cleaner to go after a microkernel to do this though, like L4 or rumprun.

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by smsm42 on Wednesday October 05, 2016 @01:55AM (#12641814)
> I think Rust has the mindshare, what it needs is people actually doing it.

That's kind of the opposite of having the mindshare, IMO :) Having the mindshare means people would be reaching for it when they need things done, not have to be dragged in, and there's a wide pool of people knowing it.

I'm pretty sure you can write OS kernel in almost any language that can be compiled into runnable code, and probably if you are really determined also in those that are compiled into bytecode. As I said, it's not the main issue.

Unless you are a titan of programming that can do an OS project all by yourself, or have more money than Google, you'll need random people to come to the project, pick up pieces and work on them. The question is, does Rust have pool of people wide enough so that probability of people wanting to work on your project is higher than your needs?

C definitely has a huge pool. So do C++, Java, JS, Python and many other languages. Rust? I'm not sure it does so far. Maybe I'm wrong.

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by bluejekyll on Wednesday October 05, 2016 @04:14AM (#12642247)
Remember, Rust is just a year old. There are already a few OS projects going in it. All the languages you mentioned are >10 years old.

I think for its age, the success it already enjoys is impressive.

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by smsm42 on Thursday October 06, 2016 @02:56PM (#12655058)
It's not a criticism of the qualities of Rust. It's just an assessment of the current state of affairs. Maybe Rust will gain the mindshare in 3 years. We'll see. I personally think having something better than C but as ubiquitous and supported as C would be awesome. Is it Rust? We'll see in 5 years.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by IgorPartola on Wednesday October 05, 2016 @01:22PM (#12645818)
I would then say that it has momentum, not mindshare.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by rbanffy on Wednesday October 05, 2016 @01:09AM (#12641672)
MkLinux was a popular environment on a portal I worked for in the late 90s. We brought dozens of Macs back into active duty as secondary workstations for the operations team.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by AstralStorm on Wednesday October 05, 2016 @03:27AM (#12642104)
In fact, SEL4 has parts in Haskell. The important things are all in Isabelle though and everything is compiled to C and machine code.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by drvdevd on Wednesday October 05, 2016 @07:07AM (#12642892)
I played around with getting a Rust kernel module to work before. And I eventually got a "hello world" in my dmesg. But what I realized in so doing was that seemingly 90% of the higher level features of Rust were lost to my module -- essentially I got the language memory security features (borrowing and ownership) but with very little standard library help, which made the whole endeavour seem much less practical still than just using C and libc (because I would have to reimplement a lot of that functionality in Rust -- Kernel Rust, if you will).

I think if the Rust communtiy wants to make it somehow to the Linux (or other UNIX or windows) Kernel space, there needs to be an effort to build Kernel Rust, if there isn't one already..

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by dbaupp on Wednesday October 05, 2016 @02:18PM (#12646362)
When were you doing this? There's now a large chunk of the standard library[1] that's explicitly designed to be used in bare-metal/zero-dependency situations, and it even includes "fancy" things like the formatting infrastructure[2] (it has to be hooked up to a writable/IO device, but that's just a trait implementation away) and string processing, certainly more than the zero-allocation subset of libc.

[1]: https://doc.rust-lang.org/core/

[2]: https://doc.rust-lang.org/core/fmt/

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by drvdevd on Wednesday October 05, 2016 @03:28PM (#12646974)
It has been at least 6 months and it's possible I just missed this! That's quite cool. Thanks! I will give this a try.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by gdamjan1 on Wednesday October 05, 2016 @07:45AM (#12643026)
well, you can't use libc for a kernel module either :)
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by drvdevd on Wednesday October 05, 2016 @08:04AM (#12643104)
No, but there's 'kernel C' (not an actual/official name) with a large reproduction of much of libc ready for use there. printk() is a good example which actually has a format string implementation (https://www.kernel.org/doc/Documentation/printk-formats.txt)
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by gdamjan1 on Wednesday October 05, 2016 @08:47AM (#12643313)
right, that shouldn't be hard to map to rust I guess
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by imglorp on Wednesday October 05, 2016 @08:02AM (#12643090)
Why does ATS not get more traction in discussions like this? That's what it's made for. This is the only mention so far in this comment page.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by nine_k on Wednesday October 05, 2016 @11:38AM (#12644764)
Not enough publicity, to my mind.

Rust is popular because Mozilla, a well-known company, is developing it for a well-known major project, a web browser.

Go is well-known due to Google, and the fact that many people with an opinion-setting power know who Rob Pike is.

Haskell, well, just spent 20 years being around, sometimes in university curricula.

ATS is only, it seems, known to people who are specifically interested in formally-correct low-level code, on the sparsely-populated intersection of math and hardware geekery.

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by kardashian007 on Tuesday October 04, 2016 @09:39PM (#12641040)
Seriously, two things: formal verification of correctness is sorely needed and a language platform which has complete, bidirectional C interoperability in targeting both kernel- and user-land which can be gradually migrated to one compilation unit a time and has much more safety, is more succinct, has C feature parity and no/minimal runtime performance hit would be requirements for candidates to change languages, but only after impressing Linus, lieutenants and contributors of undeniable value.

See also: seL4, Isabelle/Coq, Idris

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by moosingin3space on Wednesday October 05, 2016 @12:33AM (#12641569)
seL4 looks like a great base to build secure embedded systems on. There's an interesting project called robigalia that aims to make it possible to build seL4 userspace threads in Rust, which should be an excellent base to build on.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by zzzcpan on Tuesday October 04, 2016 @09:47PM (#12641072)
I disagree. It is possible to put some real effort into the compiler making the same C code safe against such problems without infinitely expensive rewrites.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by johncolanduoni on Tuesday October 04, 2016 @11:30PM (#12641357)
Tools like this for C already exist, and have existed for some time. They've failed to reach fixation, even in security-critical areas like kernels. If that is going to be the answer, then a different approach to making C safer is definitely required.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by duneroadrunner on Wednesday October 05, 2016 @04:05AM (#12642217)
Might I suggest SaferCPlusPlus [1] as the "different approach". SaferCPlusPlus is a memory safe subset of C++. But the key is that the C++ preprocessor is now powerful enough to enable the creation of compatible safe substitutes for the unsafe C/C++ elements. (Native pointers in particular of course.) So rather than rewriting all your code, translating from traditional C/C++ to SaferCPlusPlus can be just a glorified "find and replace" exercise. (Well, maybe a little more than that, but not much.)

I think solutions that don't require any code modification like Softbound and SAFEcode (and even the LLVM sanitizers) aren't popular because the resulting executables are quite slow. Whereas SaferCPlusPlus strives for minimal performance penalty. (Perhaps with some cooperation from C/C++'s formidable optimizing compilers.) (Btw, if it's not already clear, this is a shameless plug.)

And not only is conversion to SaferCPlusPlus far less effort than rewriting everything in another memory safe language, it can be done completely incrementally. What language has better "bidirectional C interoperability" than C++?

[1] https://github.com/duneroadrunner/SaferCPlusPlus

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by zzzcpan on Wednesday October 05, 2016 @08:14AM (#12643141)
Production ready tools are not there yet, they all are essentially POCs and some work has to be done to apply those ideas to existing projects. For the linux kernel, I presume, it would have to be done in gcc with a bunch of gcc flags or it won't be adopted.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by oldmanjay on Tuesday October 04, 2016 @09:31PM (#12641013)
The defensive tone of this comment is unseemly. C is just a tool, and I assure you, one that feels nothing for you.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by IgorPartola on Tuesday October 04, 2016 @09:57PM (#12641110)
I love me some C. Some of the funniest projects I have worked on have been written in C. My comment was sarcastic.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by qb45 on Wednesday October 05, 2016 @03:55AM (#12642193)
You should have mentioned the official plan of a complete rewrite as a microkernel in message-passing dialect of Visual Basic, which was supposed to land in version 3.0.

https://lkml.org/lkml/2005/3/2/247

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by tome on Wednesday October 05, 2016 @12:04PM (#12645044)
oldmanjay did realise that ...
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by sidlls on Tuesday October 04, 2016 @08:38PM (#12640809)
In fairness I haven't seen anyone make a serious comment like yours yet in this thread.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by caconym_ on Tuesday October 04, 2016 @08:40PM (#12640819)
"in b4 'we should rewrite W in X/Y/Z'" has become the new "we should rewrite W in X/Y/Z".
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by kardashian007 on Tuesday October 04, 2016 @09:44PM (#12641056)
I didnt up/down vote, but rewriting in something like a performant, secure subset of Go/Rust/X and formally-proving correctness to remove many classes of errors would arguably have immense net value greater than the pain and cost of progressive/gradual rewriting migration from C to something with fewer dangerous corners and far less code to accomplish the same system behavior.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by caconym_ on Tuesday October 04, 2016 @10:11PM (#12641148)
I don't mean to show support for either the "rewrite everything in X/Y/Z" crowd or the "C is all we need forever" crowd (or their non-straw-man equivalents). I just thought the early state of the comments in this thread was funny, is all.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by Hydraulix989 on Wednesday October 05, 2016 @01:23AM (#12641721)
If anything, security vulnerabilities are precisely the kind of bugs that easily sneak by unit tests.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by IgorPartola on Wednesday October 05, 2016 @10:07AM (#12643892)
Try reading my comment in the most sarcastic tone you can manage.

Unit testing for security vulnerabilities has been discussed to death on HN and is generally agreed that it doesn't work. Yet, every time there is any kind of vulnerability, a comment like mine shows up, except in ernest.

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by drvdevd on Wednesday October 05, 2016 @07:17AM (#12642921)
I propose a new name: a dijkstranbug. Kinda like a heisenbug except specifically for unit tests.
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by olalonde on Tuesday October 04, 2016 @11:36PM (#12641386)
You had me until "MongoDB".
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by notalaser on Wednesday October 05, 2016 @05:18AM (#12642530)
To be fair, there are a lot of places in the Linux kernel where primitive storage methods are used. In USB drivers, Vendor ID - Product ID pairs are stored in arrays. It's terrible and, most important, it doesn't scale. Being able to SELECT on a given VID would be really useful -- and it's really cool that MongoDB doesn't really impose too many constraints on the structure of your data.

Look, this hasn't been a good day so far, okay?

Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by qwertyuiop924 on Tuesday October 04, 2016 @08:21PM (#12640741)
The sarcasm is strong with this one...
Re:Linux Kernel Use-After-Free Remote Code Execution Vulnera... by SFJulie on Tuesday October 04, 2016 @09:25PM (#12640995)
kernel security and later mongodb appearing randomly in a comment is like priesthood and pedophilia randomly associated. It stings of irony.