Determine when running in a virtual machine

后端 未结 10 495
遇见更好的自我
遇见更好的自我 2020-12-12 11:39

Is there an official way for an application to determine if it is running in VMWare or Virtual PC (or whatever Microsoft is calling it now)? The code I have seen i

10条回答
  •  臣服心动
    2020-12-12 12:18

    If you want to generally detect the presence of any type of virtualization, you are best analyzing performance characteristics. Take something that is significantly slower in virtualization (such as MMU heavy workload like a fork-bomb) and time it against a normal CPU bound user space app. From the ratio you can easily tell.

    Easiest in terms of effort if you only care about certain VMMs is to look for their hardware- i.e. VMware PCI devices:

    00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08) Subsystem: VMware Inc Virtual Machine Chipset

    15ad:1976

    The vendor value is '15ad'

    There are also specific backdoor ports that work across various VMMs in various versions. SIDT trick is good too, but what if a VMM is not on the list that his code is checking?

提交回复
热议问题