Ask HN: What runs L4-related microkernels/hypervisors these days?
I've been learning about the L4 microkernel, and am thinking about doing something related to it for a research project. I'm especially curious about more recent examples of specific devices that run L4 variants (seL4, PikeOS, OKL4, etc.). I already found a few that use seL4, but to take OKL4 as an example, most of the specific devices I could find are from more than a decade ago, and I'm trying to find things from at least the last 5 or 6 years. I'm even more curious to find devices that use a form of L4 as a hypervisor.
Has anyone here worked on a device that used an L4-related kernel or hypervisor? I know one major area they're used in is defense and full of NDAs, but hopefully some of the other industries they're used in (medical devices, automotive, IoT) are a little less restrictive. Thanks in advance!
54 comments
[ 2.7 ms ] story [ 114 ms ] threadFrom the rumor mill morgue, back in 2006 there was some speculation about macOS, err, Mac OS X transitioning to L4: https://arstechnica.com/staff/2006/06/4407/
"Genode's microkernel architecture, capability-based security, sandboxed device drivers, and virtual machines in a novel operating system for commodity PC hardware and the PinePhone. Sculpt is used as day-to-day OS by the Genode developers. "
1) https://genode.org/
2) https://genode.org/download/sculpt
Failing that, I hope to be able to hack on something along those lines when I retire :)
(before someone mentiones Fuchsia - Zircon is cool'n'all, but we're talking about L4 here)
Unsafe specifically states that no code within it may introduce UB after the unsafe block exits (post-condition). It also doesn't allow certain operations no matter how hard you try (e.g. the borrow checker still applies, but you can use raw pointers in ways you couldn't outside of an unsafe block, assuming you don't introduce UB).
As someone designing a kernel in Rust, you literally cannot avoid unsafe code, regardless of the language, to implement a kernel.
It's worth mentioning that "unsafe" and "vulnerable" are two different things.
SeL4 is safe because of its extensively verified codebase written in a language suited for verification. Last I checked they port it to C after the fact, but it could just as well be ported to Rust. It'd still be "unsafe" but significantly less "vulnerable".
For example, modifying cr3 or TTBRn_EL1 is incredibly unsafe. But it happens all the time when context switching.
In the kernel I use `unsafe` pretty commonly to denote functions with preconditions not representable by the type system. This enforcement wouldn't even be possible in C or any other language I know of personally that'd be efficient to write an OS in.
The only gripe I have with Rust's unsafe is that I can't mark methods with preconditions as unsafe while still requiring `unsafe` clauses within the function body. I've thought about opening an RFC for `unsafe(pub)` for this reason.
But doing so has made iteration and overall safety of the codebase much easier to reason about because it forces me to think about every call site in which I might introduce a problem if not done carefully.
It’s true that to write a kernel safely, you need more than memory safety, but that’s kind if a different point. Folks don’t just use the unsafe construct in Rust to do kernely things.
Did you read my comment at all? How do you define "memory safe"?
That holds for Rust if you don’t use unsafe at all. It also holds in other memory safe languages (like JavaScript). Some memory safe languages gaurantee this without any caveats (JavaScript) while others guarantee it with caveats (Rust if you don’t use unsafe, Java if you don’t use certain APIs, etc).
I think this is incorrect. It is written in C, compiled to arm assembly, and the assembly is analyzed and checked by Isabelle/HOL.
Their Figure 3.2 shows how this is done: each transformation into the "Graph Language" nodes is proven formally correct. They need two proofs because the binary is automatically proven correct, i.e. what they prove is that their formalized binary is equivalent to the original binary using a HOL4 disassembler, without knowing what sort of binary they have at their hands. On the C side, they preserve semantics while proving the program correct (manually, i.e. they wrote the proofs themselves), and then they prove the two are equivalent, again automatically, using SMT solvers and throwing small chunks of data at it.
As they explain, proving the two "Graph Language" representations to be equivalent semantically is, in general, undecidable like the halting problem. However, they get away with it because the C compiler is not too wild in its output.
This is being fixed in the 2024 edition. Or now, with `#[warn(unsafe_op_in_unsafe_fn)]`.
The implementation in isabelle is proven to satisfy various key high level security properties. All 3 implementations are proven to be semantically equivalent. The compiled assembly output from gcc is also proven to be semantically equivalent to the C implementation.
Having these implementation layers is helpful for the proof work since the highest level properties can be proven over a much simpler and highly abstracted implementation (in issabelle / HOL), and the layers make the chain of equivalence proofs down to assembly more tractable. Most of the proof work is done in isabelle with the final C <-> assembly proofs using a custom automated smt based proof engine implemented in python.
The trusted components are the various language semantics / import tools, as well as a few very low level pieces of actual OS code (mostly parts of the early boot sequence iirc).
https://docs.sel4.systems/projects/sel4/frequently-asked-que...
> The multicore kernel uses a big-lock approach, which makes sense for tightly-coupled cores that share an L2 cache. It is not meant to scale to many cores,
The sky is the limit when it comes to verification of complex properties for C programs. You “just” need a few expert level theorem prover users and a couple of years :)
If you’re actually operating in the kind of domain where exhaustive verification is worth the time investment, C blows Rust out of the water (due to it’s simple semantics and mature ecosystem of verification tooling). There remain no formal semantics of the surface level rust language (and constructing one is a daunting task given its deep and baroque complexity). Verification at the MIR or LLVM levels may be more tractable, but I’m not aware of any large scale results here. C or assembly in combination with some verification tooling remains the gold standard for fast and correct software at the highest level.
Rust offers reasonable memory safety in a relatively accessible and fully automated package. It’s a better choice than C for the majority of cases, but it’s far from the last word when it comes to safety.
btw (and as noted in a sibling comment), sel4 is fully verified down to the assembly level.
Without formal semantics for the complete rust language the result couldn't be verified. Rust's complexity makes it hard to define formal semantics.
I wouldn't normally bring this up as a disadvantage of rust, but people aren't normally talking about software that has been formally verified.
Here's a Rust demo implementation of the seL4 root task (the first process that gets started on boot) using their Rust SDK and it doesn't look like it's using unsafe anywhere: https://github.com/seL4/rust-root-task-demo/blob/main/crates...
(I don't speak Rust so I might have missed it).
Go might be another interesting choice.
(let's not turn this thread into Rust vs Go vs whatever agaaaaaain ... we've got enough of those please).
It looks pretty neat - could be fun to play with!
1) https://genode.org/
2) https://genode.org/download/sculpt
They
It sounds like fun to play with - I've been wanting to try something new...
Genode is no joke.
Damn, I've been hoping someone would create something like this for quite some time!
The technologies has been there for decades, but is applicable to a greenfield setting only.
You're right, that is a problem. However, the situation on Linux is even worse since you can't even nest sandboxes/containers in most real-world situations.
I haven't looked much further but some indication https://d3s.mff.cuni.cz/files/teaching/nswi161/martin-decky-... Huawei is doing interesting work.
The new authoritative link is <https://rbg.systems>; a DNS registration oversight has that spam parked on the old site :(
I still dream about taking that project back up. Maybe there’s some way to find funding for it… otherwise i am currently looking for a job (if anyone reading wants to hire me :)
Check out https://www.dbos.dev/ for a different take on “persistent OS”, i think it’s neat!
Cool, who's going to write all the new software for your platform?
- Managed userspace
- OS services can be written in Java/Kotlin if desired, and some actually are.
- NDK has a limited set of use cases, mainly for writing native method implementations, 3D rendering and real time audio, and POSIX isn't officially supported beyond to what ISO C and ISO C++ require for their standard libraries implementation.
Naturally OEMs and people that root their devices, push stuff directly with ADB to their phones in developer mode have a different view, but I am writing from the point of view of how the OS behaves in normal devices, by people that don't even know there is such thing as the magic incantation to enable developer mode.
Is this the best we can have, I surely hope not.
I also would like to see something similar, but industry always takes one step forward, two back, in this kind of stuff.
By the way, look into TamaGo, Go based toolchain for bare metal programming firmware.
https://www.phoronix.com/news/TamaGo-Bare-Metal-Go-ARM
You would be best off getting like an SoC with wifi and display and usb ports. There are quite a few floating around these days that you can get a 3d printed case for.
IMO most of the issues with typical Unix-like OSes are more due to specific outdated architectural features rather than the Unix API or shell environment. A lot of what could be done with a completely new OS could instead be done by designing a Unix-like OS for extensibility by reducing the core API down to a small set of file calls that act as an IPC transport layer and name service and then building everything on top of that, building object-oriented wrapper libraries on top of the filesystem, and reimplementing the traditional Unix APIs outside the core filesystem ones on top of the newer APIs. Existing applications could be ported to such a system incrementally rather than having to do everything all at once or relegate them to some kind of limited "penalty box" compatibility layer (and any binary compatibility layer for Linux or other conventional Unices would integrate better into such a system than into something completely new).
0. https://sel4.systems/Foundation/Membership/
- https://www.genua.eu/it-security-solutions/data-diode-cyber-... - https://www.genua.eu/it-security-solutions/data-diode-vs-dio...
Disclaimer: I work for genua, the maker of these products.
https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&d...
https://microkerneldude.org/2016/04/14/so-the-fbi-cracked-th...
The newer L4 stuff (like Apple's Secure Enclave) is based on L4Ka::Pistachio, but with proprietary changes made by Apple. [1]
[1] https://www.blackhat.com/docs/us-16/materials/us-16-Mandt-De...
[0] https://ares-os.org/docs/helios/