Writing an OS in Rust
blog.phil-opp.com
blog.phil-opp.com
https://github.com/redox-os/redox
It's pretty incredible how quickly it's come together, there's a reasonable looking GUI already!
Edit: The author also did an AMA on reddit: https://www.reddit.com/r/rust/comments/3mw67c/i_am_jackpot51...
"In the previous post we switched from assembly to Rust, a systems programming language that provides great safety. But so far we are using unsafe features like raw pointers whenever we want to print to screen. In this post we will create a Rust module that provides a safe and easy-to-use interface for the VGA text buffer."
There's a period of writing only all the usual stuff that you've done before, then slowly discovering what kinds of abstractions you can put over it, and what kinds of stuff needs to remain super-low.
QnX is one of the most elegant OSs out there and having a public domain or GPL'd version of it would be a great thing.
[1]: http://sel4.systems
So, although the kernel is secure, server processes with higher privileges than their callers may not be. Since this is how processes talk to file systems and drivers, it's an obvious way to attack.
QNX copies data from one process space to another. This adds copying overhead, but it's usually not too bad, because 1) most messages are short, and 2) if you just created a message and sent it, it's in the cache. In practice, the big overhead item today is context switching.
This provides the same low-level challenges of writing a kernel, but it's far easier to get practically usable software than attempting to replace Linux and would actually be useful in practice.
At the moment, the only way to make a sandbox that has a chance of being perfectly secure (i.e. no security holes, ever) while still running all kinds of useful software is to use VMs to sandbox Linux/Windows kernels, and here the hypervisor is of course the weak point, and current usable hypervisors are written in C or C++.
> value
Well, Rust is a systems language, and so it should be a good fit for OS development. We're still working on bits of it, but it's a stated goal of the language, so testing that out is valuable. > Novelty
Well, Rust is still a fairly young language, so there aren't a ton of people doing things with it yet, relatively speaking. And for OS dev, which is kind of a niche subject anyway (as much as I love it), there's naturally even less. So it's basically novel by definition.My questions was not well formulated. Let me rephrase it: C is also a system language and there are plenty of OS libraries written in C. C++ could be seen as another system language. Even the syntax of Rust is similar to C/C++ according to Wikipedia article. So, what's the advantage of Rust over other systems language? Better support for autonomous systems? Reflective model? Do you have a paper? It is a research project? Do you plan to replace Linux or something like that?
While mostly a novelty, an OS capable of executing untrusted code risk-free could be a powerful tool indeed.
> what's the advantage of Rust over other systems language?
Memory safety without garbage collection is Rust's core feature. > Do you have a paper? It is a research project?
I'm not the author.