/*********************************************************
- * Copyright (C) 2006-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2006-2018 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
#include "backdoor_def.h"
#include "debug.h"
-
-typedef Bool (*SafeCheckFn)(void);
-
#if !defined(_WIN32)
# include "vmsignal.h"
# include "setjmp.h"
+#endif
+
+typedef Bool (*SafeCheckFn)(void);
+
+#if !defined(WINNT_DDK)
+static const struct {
+ const char *vendorSig;
+ const char *hypervisorName;
+} gHvVendor[] = {
+ {CPUID_KVM_HYPERVISOR_VENDOR_STRING, "Linux KVM"},
+ {CPUID_XEN_HYPERVISOR_VENDOR_STRING, "Xen"},
+};
+#endif
+
+#if !defined(_WIN32)
static sigjmp_buf jmpBuf;
static Bool jmpIsSet;
#if !defined(WINNT_DDK)
char *hypervisorSig;
+ uint32 i;
/*
* 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();
+ Debug("%s: HypervisorCPUIDSig = \"%s\".\n", __FUNCTION__,
+ hypervisorSig == NULL ? "NULL" : hypervisorSig);
if (hypervisorSig == NULL ||
Str_Strcmp(hypervisorSig, CPUID_VMWARE_HYPERVISOR_VENDOR_STRING) != 0) {
+ if (hypervisorSig != NULL) {
+ for (i = 0; i < ARRAYSIZE(gHvVendor); i++) {
+ if (Str_Strcmp(hypervisorSig, gHvVendor[i].vendorSig) == 0) {
+ Debug("%s: detected %s.\n", __FUNCTION__,
+ gHvVendor[i].hypervisorName);
+ free(hypervisorSig);
+ return FALSE;
+ }
+ }
+ }
free(hypervisorSig);
return FALSE;
}
- if (!VmCheckSafe(Hostinfo_TouchBackDoor)) {
- Debug("%s: backdoor not detected.\n", __FUNCTION__);
- return FALSE;
- }
-
} else {
free(hypervisorSig);
}
+ if (!VmCheckSafe(Hostinfo_TouchBackDoor)) {
+ Debug("%s: backdoor not detected.\n", __FUNCTION__);
+ return FALSE;
+ }
+
/* It should be safe to use the backdoor without a crash handler now. */
VmCheck_GetVersion(&version, &dummy);
#else