]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Check for Xen, VirtualPC etc., only if VMware not detected
authorOliver Kurth <okurth@vmware.com>
Wed, 7 Jun 2017 00:17:04 +0000 (17:17 -0700)
committerOliver Kurth <okurth@vmware.com>
Wed, 7 Jun 2017 00:17:04 +0000 (17:17 -0700)
open-vm-tools/lib/vmCheck/vmcheck.c

index 503c7b9f4ae28c7f295dc4fd3699fa4357ff560a..b7c34bfe8ab17373808ba35f207c393d577d14ff 100644 (file)
@@ -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. */