Linux – Which one is lighter security- and CPU-wise: LXC versus UML

linuxlxc

I'm trying to decide between "jailing" certain applications and I know the trade-offs of KVM versus LXC and how I can use them both.

Lately I came across UML (User-Mode Linux) again and was wondering how it compares with respect to security and resource consumption (or overhead, if you will).

Where can I find a comparison like that, or does anyone here know how they compare?

Basically:

  • what is the disk I/O and CPU overhead?
  • how strict is the separation and how secure is the host from what's going on in the guest?

Best Answer

  • Best Disk I/O: LXC > KVM > UML. No overhead to speak of with LXC, KVM adds a layer of indirection so it will be slower (but you could also use it with raw disks), UML will be much slower.
  • Least CPU overhead: LXC > KVM > UML. No overhead to speak of with LXC, small overhead with KVM, bigger overhead with UML.
  • Strict separation and security: UML > KVM > LXC. Contrary to the statements above by krowe, if you want security above all else, UML is the way to go. You can run the UML kernel process as a totally unprivileged user, in a restricted chrooted environment, with any hardening you want on top. Escaping from the VM would require finding a kernel bug first, and even then, at best you end up with the privileges of a normal user process on the host. Now, if you care about performance... KVM is a much better option. LXC will give you the best performance, but is also the least secure of the 3.
Related Question