The IsProcessorFeaturePresent
function has a processor feature called PF_
VIRT_
FIRMWARE_
ENABLED
. A customer enabled virtualization in their firmware, but calling IsProcessorFeaturePresent
with that feature still returned FALSE
. Why is this function lying?
It’s not lying.
Even if you enable virtualization in firmware, it may not actually be available. If the operating system is running inside a virtual machine, then it cannot access the virtualization extensions because the virtualization host is using them. Checking for PF_
VIRT_
FIRMWARE_
ENABLED
will say “No virtual extensions for you.”
Even if you think that you’re not running inside a virtual machine, you could be. If Hyper-V is enabled, then the root operating system is not actually in charge. The root operating system is running inside its own virtual machine, under the control of the hypervisor.
And remember that features like Virtualization Based Security and and Windows Defender Application Guard are security features which secretly use Hyper-V to create virtual machines to isolate untrusted code into their own containers.
Bonus chatter: I dimly recall that the IBM 360 supported self-virtualization, so you could have the host hypervisor create a virtual machine, and in the virtual machine, the operating system could itself act as a hypervisor for its own little universe of virtual machines. It’s virtual machine turtles all the way down!
re Bonus Chatter – im fairly sure that Hyper-V supports nested virtrualization on windows
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/nested-virtualization
Yes, Since Windows 10 1607 / Server2016. However, it’s only one nesting level, unlike System/360.
360 virtualization: Melinda Varian documented some of this history. The following happened circa 1970:
When [Alain] Auroux started, Cambridge was running a 360/67, not a S/370, and that 67 was a production system, so he had to avoid destabilizing it. “Vanilla” CP-67 systems created System/360 virtual machines, but they did not virtualize the 360/67; that is, they did not allow a guest to create its own virtual storage. Auroux’s first step was to modify CP-67 to...