You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/vmaware.hpp
+3-37Lines changed: 3 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -5533,7 +5533,6 @@ struct VM {
5533
5533
// Shared state and results
5534
5534
cache_state state;
5535
5535
bool hypervisor_detected = false;
5536
-
bool bypass_detected = false;
5537
5536
5538
5537
#define VMAWARE_STR2(x) #x
5539
5538
#define VMAWARE_STR(x) VMAWARE_STR2(x)
@@ -5986,7 +5985,7 @@ struct VM {
5986
5985
// the only way a legitimate interrupt can make the check false flag is if most of the samples were contaminated just in the cpuid samples but not in the serialize/lfence samples
5987
5986
// still possible tho, but it's as accurate we can get on user-mode without relying on any other hardware clock or cross-referencing with the counter thread mid-execution
5988
5987
// this is why the score of this technique is not enough to determine a VM
5989
-
trigger_vmexit(); // this forces the hypervisor to keep interception and try to bypass latency, or disable interception if on AMD and try to bypass XSAVE states
// For the median itself to exceed baremetal limits (which rarely pass 1000), an interrupt must be occurring on almost EVERY single loop iteration
6038
6037
// This is the footprint of a hypervisor continuously spamming cross-core IPIs to try and pause the counter thread (or the trigger_thread to make SERIALIZE/LFENCE take a lot of time)
debug("TIMER: Detected artificial IPI delivery to VMAware's threads");
6041
-
bypass_detected = true;
6042
-
}
6043
-
6044
-
// Now detect bypassers disabling cpuid interception with SVM
6045
-
// Even when a bypasser disables INTERCEPT_CPUID in the VMCB, they often fail to realize that certain CPUID leaves do not return static values from the hardware
6046
-
// Instead, they return values based on the LAPIC state or internal CPU registers that the hypervisor must initialize for the vCPU to function
6047
-
// if hypervisor lies about the CPU vendor, it will create 100000 more detectable signals (querying Intel-specific behavior)
6048
-
if (cpu::is_amd() && !hypervisor_detected) {
6049
-
i32 res_d0[4], res_d1[4], res_d12[4], res_ext[4];
6050
-
cpu::cpuid(res_d0, 0xD, 0); // XCR0 features
6051
-
cpu::cpuid(res_d1, 0xD, 1); // XCR0 + XSS features
6052
-
cpu::cpuid(res_d12, 0xD, 12); // CET State details
0 commit comments