163 points · by kirschner · 4y ago · 37 comments
There are also projects to replace sys-firewall with a MirageOS unikernel instead. That's something that seems very interesting.
- Xen (PVH)
- Linux KVM, FreeBSD BHyve, OpenBSD VMM
- SPT (seccomp, no hardware virtualization)
- virtio (GCE, ..)
- muen (muen.sk)
Take a look at https://github.com/solo5/solo5 which is used as the low level bits to run OCaml.To be clear, this means running an ordinary Linux binary, right?
I'm curious about the remaining advantages in practice of running multiple processes on a shared kernel rather than using hardware virtualization. I guess the main one is more efficient resource pooling, particularly memory and the page cache. I understand the primary advantage of virtualization is a smaller attack surface.
The attack surface is different, you may be interested in https://archive.fosdem.org/2019/schedule/event/solo5_unikern... and/or https://archive.fosdem.org/2019/schedule/event/solo5_unikern... :)
TL;DR: hardware virtualization is pushing trust into hardware -- but can you trust the hardware implementation (to isolate memory)?
Other researchers also share the dislike of fork... https://www.microsoft.com/en-us/research/uploads/prod/2019/0...
A 2010 paper where I sketched out some of the early ideas around "multiscale" is here: https://anil.recoil.org/papers/2010-bcs-visions.pdf
It took a little longer than I'd planned, but thanks to the hard work of so many MirageOS contributors, now's a pretty good time to glue back personal containers and self-hosted data management infrastructure again! Unikernel-based messaging has really come together in the past couple of years: https://tarides.com/blog/2022-03-08-secure-virtual-messages-...
Since there are no processes, there's no concept of "fork", but indeed you can run multiple tasks at the same time (using the same address space). Why again would you need multiple processes? Since the programming language OCaml has a semantics and is memory-safe, there's no strong reason for isolation at execution time (apart from the C bits, which we try to keep to a minimum and compile with runtime safety flags (red-zone for stack protection, mapping execute-only (seems to only reliably work on OpenBSD), etc.)).
Also I would say there are reasons for isolation beyond memory safety.
> Also I would say there are reasons for isolation beyond memory safety.
Would you mind to elaborate which reasons you are thinking of?
Do you have a concept of logging daemon? How would I run prometheus exporter-like things?
Is there a FAQ where questions along these lines are answered?
No FAQ for this sort of thing yet, but we should start assembling one sometime soon. Questions like this very welcome on the discussion forums: https://discuss.ocaml.org/t/ann-mirageos-4-0/9598 to help us get started.
There's a nice collection of unikernels over at: https://github.com/roburio/unikernels and https://github.com/tarides/unikernels for various infrastructure pieces (like https, smtp, dns, ip filters, etc) that are good to crib from for your own infrastructure.
For example, they show how you can host a static site. Great, but can I run my Flask API?
If you want a POSIX unikernel have a look at Unikraft.