From: Oliver Kurth Date: Wed, 7 Jun 2017 00:17:04 +0000 (-0700) Subject: Check for Xen, VirtualPC etc., only if VMware not detected X-Git-Tag: stable-10.1.10~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b7cdd8b4d809bb515e65acd73b719b21fb9793f;p=thirdparty%2Fopen-vm-tools.git Check for Xen, VirtualPC etc., only if VMware not detected --- diff --git a/open-vm-tools/lib/vmCheck/vmcheck.c b/open-vm-tools/lib/vmCheck/vmcheck.c index 503c7b9f4..b7c34bfe8 100644 --- a/open-vm-tools/lib/vmCheck/vmcheck.c +++ b/open-vm-tools/lib/vmCheck/vmcheck.c @@ -35,6 +35,7 @@ #include "vm_tools_version.h" #if !defined(WINNT_DDK) # include "hostinfo.h" +# include "str.h" #endif /* @@ -254,19 +255,35 @@ VmCheck_IsVirtualWorld(void) uint32 dummy; #if !defined(WINNT_DDK) - if (VmCheckSafe(Hostinfo_TouchXen)) { - Debug("%s: detected Xen.\n", __FUNCTION__); - return FALSE; - } + char *hypervisorSig; - if (VmCheckSafe(Hostinfo_TouchVirtualPC)) { - Debug("%s: detected Virtual PC.\n", __FUNCTION__); - return FALSE; - } + /* + * Check for other environments like Xen and VirtualPC only if we haven't + * already detected that we are on a VMware hypervisor. See PR 1035346. + */ + hypervisorSig = Hostinfo_HypervisorCPUIDSig(); + if (hypervisorSig == NULL || + Str_Strcmp(hypervisorSig, CPUID_VMWARE_HYPERVISOR_VENDOR_STRING) != 0) { - if (!VmCheckSafe(Hostinfo_TouchBackDoor)) { - Debug("%s: backdoor not detected.\n", __FUNCTION__); - return FALSE; + free(hypervisorSig); + + if (VmCheckSafe(Hostinfo_TouchXen)) { + Debug("%s: detected Xen.\n", __FUNCTION__); + return FALSE; + } + + if (VmCheckSafe(Hostinfo_TouchVirtualPC)) { + Debug("%s: detected Virtual PC.\n", __FUNCTION__); + return FALSE; + } + + if (!VmCheckSafe(Hostinfo_TouchBackDoor)) { + Debug("%s: backdoor not detected.\n", __FUNCTION__); + return FALSE; + } + + } else { + free(hypervisorSig); } /* It should be safe to use the backdoor without a crash handler now. */