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: docs/documentation.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -530,7 +530,7 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
530
530
|`VM::TPM`| Check if the system has a physical TPM by matching the TPM manufacturer against known physical TPM chip vendors | 🪟 | 100% ||||[link](https://github.com/kernelwernel/VMAware/tree/main/src/vmaware.hpp#L8075)|
531
531
|`VM::PCI_DEVICES`| Check for PCI vendor and device IDs that are VM-specific | 🐧🪟 | 95% ||||[link](https://github.com/kernelwernel/VMAware/tree/main/src/vmaware.hpp#L5979)|
|`VM::TRAP`| Check if after raising two traps at the same RIP, a hypervisor interferes with the instruction pointer delivery | 🪟 | 100% ||||[link](https://github.com/kernelwernel/VMAware/tree/main/src/vmaware.hpp#L8319)|
533
+
|`VM::TRAP`| Check if after raising two traps at the same RIP, a hypervisor interferes with the instruction pointer delivery | 🪟 | 100% |||On AMD CPUs, this technique will always false flag |[link](https://github.com/kernelwernel/VMAware/tree/main/src/vmaware.hpp#L8320)|
* @brief Check if after raising two traps at the same RIP, a hypervisor interferes with the instruction pointer delivery
8318
8318
* @category Windows
8319
+
* @note On AMD CPUs, this technique will always false flag
8319
8320
* @implements VM::TRAP
8320
8321
*/
8321
8322
[[nodiscard]] staticbooltrap() {
8322
8323
if (util::hyper_x() == HYPERV_ARTIFACT_VM) {
8323
8324
returnfalse;
8324
8325
}
8326
+
// Intel explicitly guarantees (in the SDM) that if TF and DR0 both trigger on the same instruction, DR6.BS and DR6.B0 are both set in the resulting #DB
8327
+
// On AMD CPUs they do not set both DR6.BS and DR6.B0 when a single‐step and a DR0 breakpoint coincide on a trappable/serializing instruction
8328
+
// whenever a hardware breakpoint and TF collide, only the breakpoint bit shows up in DR6
8329
+
if (!cpu::is_intel()) {
8330
+
returnfalse;
8331
+
}
8325
8332
8326
8333
// push flags, set TF-bit, pop flags, execute a dummy instruction, then return
8327
8334
constexprunsignedchar trampoline[] = {
@@ -8335,17 +8342,17 @@ struct VM {
8335
8342
};
8336
8343
SIZE_T trampSize = sizeof(trampoline);
8337
8344
8338
-
//allocate RWX memory for trampoline, simple way to support x86 without recurring to inline assembly
8345
+
// simple way to support x86 without recurring to inline assembly
8339
8346
void* execMem = VirtualAlloc(nullptr, trampSize,
8340
8347
MEM_COMMIT | MEM_RESERVE,
8341
8348
PAGE_EXECUTE_READWRITE);
8342
8349
if (!execMem) {
8343
8350
returnfalse;
8344
8351
}
8345
-
//Copy payload
8352
+
//copy payload
8346
8353
memcpy(execMem, trampoline, trampSize);
8347
8354
8348
-
//Variables to track detection
8355
+
//variables to track detection
8349
8356
bool hypervisorCaught = false;
8350
8357
int hitCount = 0;
8351
8358
@@ -8355,7 +8362,7 @@ struct VM {
8355
8362
HANDLE thr = GetCurrentThread();
8356
8363
GetThreadContext(thr, &dbgCtx);
8357
8364
8358
-
//Set Dr0 to trampoline+offset (step triggers here)
8365
+
//set Dr0 to trampoline+offset (step triggers here)
0 commit comments