How virtual is virtualization

virtualization

While reading different materials on different subjects every now and then I come back upon the question: How virtual really is virtualization? With "virtualization" I mean things like Virtual PC and VMWare, which allow you to run an guest OS. In particular, what I don't understand is:

  • Does the virtual machine provide an environment which is fundamentally indistinguishable from a physical machine? Of course, there will be some practical differences (like hypervisor call escape hatches, dummy hardware component names, etc.) which allow the detection of a virtual machine, but will there be any incompatibilities?
  • If the environment is fully compatible with a physical machine, then are nested virtual machines possible?
  • If not, does that mean that the guest OS has to be specifically adapted for running inside a virtual machine? If so, then does that mean that most of today's OS'es have already been adapted for most VM vendors?
  • Are these things different for software-based virtualization vs hardware based?
  • What exactly is the difference between software-based virtualization and hardware-based?

Best Answer

As far as I know:

  • There were studies on the possibility of an "undetectable rootkit" where a malicious hypervisor would sit between your computer and the hardware. Security firms (and CPU vendors) were enraged that someone devised something like that and told no one could detect it, so they actually came with a way using timing functions and comparing the results with an external source. So virtualization is almost undetectable, but if you pay really close to small details and you have an external reference, there are ways to figure out you're being virtualized. It shouldn't cause any incompatibility, though.
  • It's not. Your virtualized CPU doesn't have the same capabilities your physical one has. The Intel virtualization instructions are available only to the host OS, for instance. That doesn't mean, however, that you cannot have a virtual machine inside a virtual machine: it just means it's gonna be damn slow.
  • OSes don't have to be adapted for virtual machines. It rather goes the other way around.
  • Yes, they are to some extent. Software virtualization will always work. Hardware virtualization usually isn't transitive (guest OSes can't use hardware virtualization to host more guest OSes).
  • There must be more to that, but I think that's a good start.
Related Question