Skip to content

Commit 907bddc

Browse files
author
Requiem
committed
final changes before 2.4.0 release
1 parent 3b2548a commit 907bddc

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

docs/documentation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
528528
| `VM::AUDIO` | Check if no waveform-audio output devices are present in the system | 🪟 | 25% | | | | [link](https://github.com/kernelwernel/VMAware/tree/main/src/vmaware.hpp#L8039) |
529529
| `VM::NSJAIL_PID` | Check if process status matches with nsjail patterns with PID anomalies | 🐧 | 75% | | | | [link](https://github.com/kernelwernel/VMAware/tree/main/src/vmaware.hpp#L5245) |
530530
| `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#L8081) |
531-
| `VM::PCI_DEVICES` | Check for PCI vendor and device IDs that are VM-specific | 🐧🪟 | 50% | | | | [link](https://github.com/kernelwernel/VMAware/tree/main/src/vmaware.hpp#L5985) |
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#L5985) |
532532
| `VM::QEMU_PASSTHROUGH` | Check for QEMU's hot-plug signature | 🪟 | 90% | | | | [link](https://github.com/kernelwernel/VMAware/tree/main/src/vmaware.hpp#L8164) |
533533
| `VM::TRAP` | Check for two traps being raised at the same RIP, a hypervisor interferes with the instruction pointer delivery | 🪟 | 100% | | | | [link](https://github.com/kernelwernel/VMAware/tree/main/src/vmaware.hpp#L8338) |
534534

src/vmaware.hpp

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5687,20 +5687,14 @@ struct VM {
56875687
return true;
56885688
}
56895689

5690-
// 1b) lives under _SB.PCI0 but not under _SB.PR00
5691-
if (contains("_SB.PCI0", 7) && !contains("_SB.PR00", 7)) {
5692-
debug("FIRMWARE: SSDT namespace indicates VM (_SB.PCI0 only)");
5693-
return true;
5694-
}
5695-
5696-
// 1c) power/adapter objects
5690+
// 1b) power/adapter objects
56975691
if (contains("PWRB", 4) && contains("SLPB", 4) && contains("ACAD", 4)) {
56985692
debug("FIRMWARE: VM‐specific power/adapter objects detected");
56995693
return true;
57005694
}
57015695
}
57025696

5703-
// 2) Spoofed AMD manufacturer
5697+
// 2) spoofed AMD manufacturer
57045698
constexpr char man_short[] = "Advanced Micro Devices";
57055699
constexpr char man_full[] = "Advanced Micro Devices, Inc.";
57065700
const size_t short_len = sizeof(man_short) - 1;
@@ -5730,7 +5724,7 @@ struct VM {
57305724
}
57315725
}
57325726

5733-
// 4) Known patches used by popular hardeners
5727+
// 4) known patches used by popular hardeners
57345728
constexpr char marker[] = "777777";
57355729
constexpr size_t mlen = sizeof(marker) - 1;
57365730
if (len >= mlen) {
@@ -5745,7 +5739,7 @@ struct VM {
57455739
return false;
57465740
};
57475741

5748-
// 1) Enumerate ACPI tables
5742+
// 1) enumerate ACPI tables
57495743
const DWORD enumSize = EnumSystemFirmwareTables(ACPI_SIG, nullptr, 0);
57505744
if (enumSize == 0) return false;
57515745

@@ -5770,7 +5764,7 @@ struct VM {
57705764
return true;
57715765
}
57725766

5773-
// Helper to fetch one table into a malloc'd buffer
5767+
// helper to fetch one table into a malloc'd buffer
57745768
auto fetch = [&](DWORD provider, DWORD tableID, BYTE*& outBuf, size_t& outLen) -> bool {
57755769
const UINT sz = GetSystemFirmwareTable(provider, __bswap32(tableID), nullptr, 0);
57765770
if (sz == 0) return false;
@@ -5786,7 +5780,7 @@ struct VM {
57865780
return true;
57875781
};
57885782

5789-
// 3) Scan FADT + each ACPI table
5783+
// 3) scan FADT + each ACPI table
57905784
for (auto tbl : tables) {
57915785
if (tbl == facpSig) {
57925786
BYTE* buf = nullptr;
@@ -5842,7 +5836,7 @@ struct VM {
58425836
return true;
58435837
}
58445838

5845-
// 5) SMBIOS / FIRM tables
5839+
// 5) SMBIOS (RSMB) / FIRM tables
58465840
const DWORD smbios[] = { FIRM_SIG, RSMB_SIG };
58475841
for (DWORD provider : smbios) {
58485842
const UINT enumSMB = EnumSystemFirmwareTables(provider, nullptr, 0);
@@ -8201,7 +8195,6 @@ struct VM {
82018195
nullptr,
82028196
DIGCF_PRESENT);
82038197
if (hDevInfo == INVALID_HANDLE_VALUE) {
8204-
std::wcerr << L"[ERROR] SetupDiGetClassDevsW failed\n";
82058198
return false;
82068199
}
82078200

@@ -8218,7 +8211,6 @@ struct VM {
82188211
hDevInfo, &devInfo, &key, &propType,
82198212
nullptr, 0, &requiredSize, 0);
82208213
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER || requiredSize == 0) {
8221-
// No LocationPaths or error; skip
82228214
continue;
82238215
}
82248216

@@ -8241,7 +8233,7 @@ struct VM {
82418233

82428234
#ifdef __VMAWARE_DEBUG__
82438235
for (auto& wstr : paths) {
8244-
debug(wstr);
8236+
debug("QEMU_PASSTHROUGH: ", wstr);
82458237
}
82468238
#endif
82478239

@@ -9542,6 +9534,7 @@ struct VM {
95429534
case HIGH_THRESHOLD: return "setting flag, error";
95439535
case DYNAMIC: return "setting flag, error";
95449536
case MULTIPLE: return "setting flag, error";
9537+
default: return "Unknown flag";
95459538
}
95469539
}
95479540

@@ -10041,7 +10034,7 @@ std::pair<VM::enum_flags, VM::core::technique> VM::core::technique_list[] = {
1004110034

1004210035
#if (LINUX || WINDOWS)
1004310036
std::make_pair(VM::FIRMWARE, VM::core::technique(100, VM::firmware)),
10044-
std::make_pair(VM::PCI_DEVICES, VM::core::technique(50, VM::pci_devices)),
10037+
std::make_pair(VM::PCI_DEVICES, VM::core::technique(95, VM::pci_devices)),
1004510038
std::make_pair(VM::SIDT, VM::core::technique(50, VM::sidt)),
1004610039
std::make_pair(VM::DISK_SIZE, VM::core::technique(60, VM::disk_size)),
1004710040
std::make_pair(VM::HYPERV_HOSTNAME, VM::core::technique(30, VM::hyperv_hostname)),

0 commit comments

Comments
 (0)