Skip to content

Commit d5fec75

Browse files
author
Requiem
committed
Merge branch 'dev' of https://github.com/NotRequiem/VMAware into dev
2 parents a4afa8b + 7247714 commit d5fec75

2 files changed

Lines changed: 67 additions & 30 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
<img align="center" src="https://img.shields.io/github/downloads/kernelwernel/VMAware/total">
66
<img align="center" src="https://img.shields.io/github/license/a0rtega/pafish">
77
<img align="center" src="https://img.shields.io/github/license/kernelwernel/auto-stuff">
8-
<img align="center" src="https://github.com/kernelwernel/VMAware/actions/workflows/codeql-analysis.yml/badge.svg?style=flat-square" alt="CodeQL Analysis">
8+
<a href="https://github.com/kernelwernel/VMAware/actions/workflows/code_ql_analysis.yml">
9+
<img align="center" src="https://github.com/kernelwernel/VMAware/actions/workflows/code_ql_analysis.yml/badge.svg" alt="CodeQL Analysis">
10+
</a>
11+
912
</p>
1013

1114
**VMAware** (VM + Aware) is a cross-platform C++ library for virtual machine detection.

src/vmaware.hpp

Lines changed: 63 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9867,8 +9867,6 @@ struct VM {
98679867
}
98689868
#endif
98699869

9870-
bool found = false;
9871-
98729870
for (const auto& dev : devices) {
98739871
const u32 id = ((dev.vendor_id << 16) | dev.device_id);
98749872

@@ -9924,41 +9922,77 @@ struct VM {
99249922
case 0x0e0f8002: // Root Hub
99259923
case 0x0e0f8003: // Root Hub
99269924
case 0x0e0ff80a: // Smoker FX2
9927-
9925+
9926+
// Red Hat + QEMU
9927+
case 0x1b360001: // Red Hat, Inc. QEMU PCI-PCI bridge
9928+
case 0x1b360002: // Red Hat, Inc. QEMU PCI 16550A Adapter
9929+
case 0x1b360003: // Red Hat, Inc. QEMU PCI Dual-port 16550A Adapter
9930+
case 0x1b360004: // Red Hat, Inc. QEMU PCI Quad-port 16550A Adapter
9931+
case 0x1b360005: // Red Hat, Inc. QEMU PCI Test Device
9932+
case 0x1b360008: // Red Hat, Inc. QEMU PCIe Host bridge
9933+
case 0x1b360009: // Red Hat, Inc. QEMU PCI Expander bridge
9934+
case 0x1b36000b: // Red Hat, Inc. QEMU PCIe Expander bridge
9935+
case 0x1b36000c: // Red Hat, Inc. QEMU PCIe Root port
9936+
case 0x1b36000d: // Red Hat, Inc. QEMU XHCI Host Controller
9937+
case 0x1b360010: // Red Hat, Inc. QEMU NVM Express Controller
9938+
case 0x1b360011: // Red Hat, Inc. QEMU PVPanic device
9939+
case 0x1b360013: // Red Hat, Inc. QEMU UFS Host Controller
9940+
9941+
// QEMU
9942+
case 0x6270001: // Adomax Technology Co., Ltd QEMU Tablet
9943+
case 0x1d1d1f1f: // CNEX Labs QEMU NVM Express LightNVM Controller
9944+
case 0x80865845: // Intel Corporation QEMU NVM Express Controller
9945+
case 0x1d6b0200: // Linux Foundation Qemu Audio Device
9946+
9947+
// vGPUs (mostly NVIDIA)
9948+
case 0x10de0fe7: // GK107GL [GRID K100 vGPU]
9949+
case 0x10de0ff7: // GK107GL [GRID K140Q vGPU]
9950+
case 0x10de118d: // GK104GL [GRID K200 vGPU]
9951+
case 0x10de11b0: // GK104GL [GRID K240Q\K260Q vGPU]
9952+
case 0x1ec6020f: // Vastai Technologies SG100 vGPU
9953+
99289954
// VirtualBox
99299955
case 0x80ee0021: // USB Tablet
99309956
case 0x80ee0022: // multitouch tablet
9931-
9932-
// Connectix (VirtualPC)
9933-
case 0x29556e61: // OHCI USB 1.1 controller
9934-
found = true;
9935-
break;
9936-
}
9937-
9938-
if (found) {
9939-
debug(
9940-
"PCI_VM_DEVICE_ID: found vendor ID = ",
9941-
"0x", std::setw(4), std::setfill('0'), std::hex, dev.vendor_id,
9942-
" device ID = 0x", std::setw(4), std::setfill('0'), std::hex, dev.device_id
9943-
);
9944-
9945-
break;
9957+
9958+
// misc
9959+
case 0x29556e61: // Connectix (VirtualPC) OHCI USB 1.1 controller
9960+
case 0x1ab84000: // Parallels, Inc. Virtual Machine Communication Interface
9961+
debug(
9962+
"PCI_VM_DEVICE_ID: found vendor ID = ",
9963+
"0x", std::setw(4), std::setfill('0'), std::hex, dev.vendor_id,
9964+
" device ID = 0x", std::setw(4), std::setfill('0'), std::hex, dev.device_id
9965+
);
9966+
9967+
return true;
99469968
}
9969+
9970+
// TODO: EXTRAS TO ADD (64 instead of 32 bits for device_id field)
9971+
//
9972+
// Advanced Micro Devices, Inc. [AMD] 1022 QEMU Virtual Machine 1af41100
9973+
// Apple Inc. 106b QEMU Virtual Machine 1af41100
9974+
// Cirrus Logic 1013 QEMU Virtual Machine 1af41100
9975+
// Intel Corporation 8086 QEMU Virtual Machine 1af41100
9976+
// NEC Corporation 1033 QEMU Virtual Machine 1af41100
9977+
// Realtek Semiconductor Co., Ltd. 10ec QEMU Virtual Machine 1af41100
9978+
// VIA Technologies, Inc. 1106 QEMU Virtual Machine 1af41100
9979+
// Red Hat, Inc. 1af4 QEMU Virtual Machine 1af41100
9980+
// Red Hat, Inc. 1b36 QEMU Virtual Machine 1af41100
99479981
}
9948-
9949-
return found;
9982+
9983+
return false;
99509984
#endif
99519985
}
9952-
9986+
99539987
// ADD NEW TECHNIQUE FUNCTION HERE
9954-
9955-
9956-
9957-
9958-
9959-
9960-
9961-
9988+
9989+
9990+
9991+
9992+
9993+
9994+
9995+
99629996

99639997

99649998

0 commit comments

Comments
 (0)