kernelwernel / VMAware

VM detection library and tool
GNU General Public License v3.0
291 stars 28 forks source link

Could not compile on ARM #63

Closed MarekKnapek closed 4 months ago

MarekKnapek commented 4 months ago

Hi, I followed this tutorial how to run Ubuntu for ARM https://futurewei-cloud.github.io/ARM-Datacenter/qemu/how-to-launch-aarch64-vm/ Then I tried to compile the CLI application, I did not used CMake, because this Ubuntu version does not have new enough CMake version.

g++ cli.cpp

In file included from cli.cpp:1:0:
vmaware.hpp:170:10: fatal error: cpuid.h: No such file or directory
 #include <cpuid.h>
          ^~~~~~~~~
compilation terminated.
kernelwernel commented 4 months ago

I've pushed some commits to address your issue, can you do a git pull and retry it?

MarekKnapek commented 4 months ago

Nothing could be pulled. Are you sure you pushed correctly?

kernelwernel commented 4 months ago

Nothing could be pulled. Are you sure you pushed correctly?

i fixed it here, can you try to git clone it again then?

MarekKnapek commented 4 months ago
In file included from cli.cpp:1:0:
vmaware.hpp:182:10: fatal error: immintrin.h: No such file or directory
 #include <immintrin.h>
          ^~~~~~~~~~~~~
compilation terminated.
kernelwernel commented 4 months ago
In file included from cli.cpp:1:0:
vmaware.hpp:182:10: fatal error: immintrin.h: No such file or directory
 #include <immintrin.h>
          ^~~~~~~~~~~~~
compilation terminated.

committed and pushed a fix, can you retry?

MarekKnapek commented 4 months ago
vmaware.hpp: In static member function ‘static void VM::cpu::cpuid(VM::u32&, VM::u32&, VM::u32&, VM::u32&, VM::u32, VM::u32)’:
vmaware.hpp:433:13: error: ‘__cpuid_count’ was not declared in this scope
             __cpuid_count(a_leaf, c_leaf, a, b, c, d);
             ^~~~~~~~~~~~~
vmaware.hpp:433:13: note: suggested alternative: ‘thread_count’
             __cpuid_count(a_leaf, c_leaf, a, b, c, d);
             ^~~~~~~~~~~~~
             thread_count
vmaware.hpp: In static member function ‘static void VM::cpu::cpuid(int32_t*, VM::u32, VM::u32)’:
vmaware.hpp:453:13: error: ‘__cpuid_count’ was not declared in this scope
             __cpuid_count(a_leaf, c_leaf, x[0], x[1], x[2], x[3]);
             ^~~~~~~~~~~~~
vmaware.hpp:453:13: note: suggested alternative: ‘thread_count’
             __cpuid_count(a_leaf, c_leaf, x[0], x[1], x[2], x[3]);
             ^~~~~~~~~~~~~
             thread_count
kernelwernel commented 4 months ago
vmaware.hpp: In static member function ‘static void VM::cpu::cpuid(VM::u32&, VM::u32&, VM::u32&, VM::u32&, VM::u32, VM::u32)’:
vmaware.hpp:433:13: error: ‘__cpuid_count’ was not declared in this scope
             __cpuid_count(a_leaf, c_leaf, a, b, c, d);
             ^~~~~~~~~~~~~
vmaware.hpp:433:13: note: suggested alternative: ‘thread_count’
             __cpuid_count(a_leaf, c_leaf, a, b, c, d);
             ^~~~~~~~~~~~~
             thread_count
vmaware.hpp: In static member function ‘static void VM::cpu::cpuid(int32_t*, VM::u32, VM::u32)’:
vmaware.hpp:453:13: error: ‘__cpuid_count’ was not declared in this scope
             __cpuid_count(a_leaf, c_leaf, x[0], x[1], x[2], x[3]);
             ^~~~~~~~~~~~~
vmaware.hpp:453:13: note: suggested alternative: ‘thread_count’
             __cpuid_count(a_leaf, c_leaf, x[0], x[1], x[2], x[3]);
             ^~~~~~~~~~~~~
             thread_count

try again, should be the last time (sorry :disappointed:)

MarekKnapek commented 4 months ago
In file included from cli.cpp:1:0:
vmaware.hpp:5524:2: error: #else without #if
 #else
  ^~~~
vmaware.hpp:5526:2: error: #endif without #if
 #endif
  ^~~~~
In file included from cli.cpp:1:0:
vmaware.hpp: In static member function ‘static void VM::cpu::cpuid(VM::u32&, VM::u32&, VM::u32&, VM::u32&, VM::u32, VM::u32)’:
vmaware.hpp:434:20: error: return-statement with a value, in function returning 'void' [-fpermissive]
             return false;
                    ^~~~~
vmaware.hpp: In static member function ‘static void VM::cpu::cpuid(int32_t*, VM::u32, VM::u32)’:
vmaware.hpp:455:20: error: return-statement with a value, in function returning 'void' [-fpermissive]
             return false;
                    ^~~~~
In file included from cli.cpp:1:0:
vmaware.hpp: In lambda function:
vmaware.hpp:5520:17: error: ‘__get_cpuid_max’ was not declared in this scope
         return (__get_cpuid_max(ext, nullptr) > 0);
                 ^~~~~~~~~~~~~~~
vmaware.hpp:5520:17: note: suggested alternative: ‘__getpgid’
         return (__get_cpuid_max(ext, nullptr) > 0);
                 ^~~~~~~~~~~~~~~
                 __getpgid
kernelwernel commented 4 months ago
In file included from cli.cpp:1:0:
vmaware.hpp:5524:2: error: #else without #if
 #else
  ^~~~
vmaware.hpp:5526:2: error: #endif without #if
 #endif
  ^~~~~
In file included from cli.cpp:1:0:
vmaware.hpp: In static member function ‘static void VM::cpu::cpuid(VM::u32&, VM::u32&, VM::u32&, VM::u32&, VM::u32, VM::u32)’:
vmaware.hpp:434:20: error: return-statement with a value, in function returning 'void' [-fpermissive]
             return false;
                    ^~~~~
vmaware.hpp: In static member function ‘static void VM::cpu::cpuid(int32_t*, VM::u32, VM::u32)’:
vmaware.hpp:455:20: error: return-statement with a value, in function returning 'void' [-fpermissive]
             return false;
                    ^~~~~
In file included from cli.cpp:1:0:
vmaware.hpp: In lambda function:
vmaware.hpp:5520:17: error: ‘__get_cpuid_max’ was not declared in this scope
         return (__get_cpuid_max(ext, nullptr) > 0);
                 ^~~~~~~~~~~~~~~
vmaware.hpp:5520:17: note: suggested alternative: ‘__getpgid’
         return (__get_cpuid_max(ext, nullptr) > 0);
                 ^~~~~~~~~~~~~~~
                 __getpgid

done again, sorry

MarekKnapek commented 4 months ago
In file included from cli.cpp:1:0:
vmaware.hpp: In static member function ‘static void VM::cpu::cpuid(VM::u32&, VM::u32&, VM::u32&, VM::u32&, VM::u32, VM::u32)’:
vmaware.hpp:434:20: error: return-statement with a value, in function returning 'void' [-fpermissive]
             return false;
                    ^~~~~
vmaware.hpp: In static member function ‘static void VM::cpu::cpuid(int32_t*, VM::u32, VM::u32)’:
vmaware.hpp:455:20: error: return-statement with a value, in function returning 'void' [-fpermissive]
             return false;
                    ^~~~~
kernelwernel commented 4 months ago
In file included from cli.cpp:1:0:
vmaware.hpp: In static member function ‘static void VM::cpu::cpuid(VM::u32&, VM::u32&, VM::u32&, VM::u32&, VM::u32, VM::u32)’:
vmaware.hpp:434:20: error: return-statement with a value, in function returning 'void' [-fpermissive]
             return false;
                    ^~~~~
vmaware.hpp: In static member function ‘static void VM::cpu::cpuid(int32_t*, VM::u32, VM::u32)’:
vmaware.hpp:455:20: error: return-statement with a value, in function returning 'void' [-fpermissive]
             return false;
                    ^~~~~

ok, this SHOULD be the last one, if it isn't then yeah I really might be stupid.

MarekKnapek commented 4 months ago
[    NOTE    ] Running under root would give better results
[NOT DETECTED] Checking VMID...
[NOT DETECTED] Checking CPU brand...
[NOT DETECTED] Checking CPUID hypervisor bit...
[NOT DETECTED] Checking CPUID 0x4 leaf...
[NOT DETECTED] Checking hypervisor brand...
[NOT DETECTED] Checking RDTSC...
[NOT DETECTED] Checking sidt null byte...
[NOT DETECTED] Checking processor count...
[NOT DETECTED] Checking MAC address...
[  DETECTED  ] Checking temperature...
[  DETECTED  ] Checking systemd virtualisation...
[  DETECTED  ] Checking chassis vendor...
[  DETECTED  ] Checking chassis type...
[NOT DETECTED] Checking Dockerenv...
[NOT DETECTED] Checking dmidecode output...
[NOT DETECTED] Checking dmesg output...
[NOT DETECTED] Checking hwmon presence...
[NOT DETECTED] Checking cursor...
[NOT DETECTED] Checking VMware registry...
[NOT DETECTED] Checking VBox registry...
[NOT DETECTED] Checking users...
[NOT DETECTED] Checking DLLs...
[NOT DETECTED] Checking registry...
[NOT DETECTED] Checking Sunbelt CWSandbox directory...
[NOT DETECTED] Checking Wine...
[NOT DETECTED] Checking VM files...
[NOT DETECTED] Checking hw.model...
[  DETECTED  ] Checking disk size...
[NOT DETECTED] Checking VBox default specs...
[NOT DETECTED] Checking VBox network provider match...
[NOT DETECTED] Checking computer name...
[NOT DETECTED] Checking hostname...
[  DETECTED  ] Checking low memory space...
[NOT DETECTED] Checking VM processes...
[NOT DETECTED] Checking default Linux user/host...
[NOT DETECTED] Checking VBox window class...
[NOT DETECTED] Checking gamarue ransomware technique...
[NOT DETECTED] Checking WMIC outputs...
[NOT DETECTED] Checking 0x4 leaf of VMID...
[NOT DETECTED] Checking Parallels techniques...
[NOT DETECTED] Checking RDTSC VMEXIT...
[NOT DETECTED] Checking loaded DLLs...
[NOT DETECTED] Checking QEMU CPU brand...
[NOT DETECTED] Checking BOCHS CPU techniques...
[NOT DETECTED] Checking VirtualPC motherboard...
[NOT DETECTED] Checking BIOS serial number...
[NOT DETECTED] Checking Hyper-V registry...
[NOT DETECTED] Checking Hyper-V WMI output...
[NOT DETECTED] Checking VirtualBox shared folders...
[NOT DETECTED] Checking VirtualBox MSSMBIOS...
[NOT DETECTED] Checking MacOS hw.memsize...
[NOT DETECTED] Checking MacOS registry IO-kit...
[NOT DETECTED] Checking IO registry grep...
[NOT DETECTED] Checking MacOS SIP...
[NOT DETECTED] Checking KVM registries...
[NOT DETECTED] Checking KVM drivers...
[NOT DETECTED] Checking KVM directories...
[NOT DETECTED] Checking HKLM registries...
[NOT DETECTED] Checking Audio device...
[NOT DETECTED] Checking qemu-ga process...
[NOT DETECTED] Checking MSR validity...
[NOT DETECTED] Checking QEMU processes...
[NOT DETECTED] Checking QEMU directories...
[NOT DETECTED] Checking VPC processes...
[NOT DETECTED] Checking VPC invalid instructions...
[NOT DETECTED] Checking SIDT...
[NOT DETECTED] Checking SGDT...
[NOT DETECTED] Checking SLDT...
[NOT DETECTED] Checking Offensive Security SIDT...
[NOT DETECTED] Checking Offensive Security SGDT...
[NOT DETECTED] Checking Offensive Security SLDT...
[NOT DETECTED] Checking Hyper-V motherboard...
[NOT DETECTED] Checking Extra VM files...

VM brand: QEMU
VM certainty: 100%
VM confirmation: true

====== CONCLUSION: Running inside a QEMU VM ======
MarekKnapek commented 4 months ago
[NOT DETECTED] Checking VMID...
[NOT DETECTED] Checking CPU brand...
[NOT DETECTED] Checking CPUID hypervisor bit...
[NOT DETECTED] Checking CPUID 0x4 leaf...
[NOT DETECTED] Checking hypervisor brand...
[NOT DETECTED] Checking RDTSC...
[NOT DETECTED] Checking sidt null byte...
[NOT DETECTED] Checking processor count...
[NOT DETECTED] Checking MAC address...
[  DETECTED  ] Checking temperature...
[  DETECTED  ] Checking systemd virtualisation...
[  DETECTED  ] Checking chassis vendor...
[  DETECTED  ] Checking chassis type...
[NOT DETECTED] Checking Dockerenv...
[NOT DETECTED] Checking dmidecode output...
[NOT DETECTED] Checking dmesg output...
[NOT DETECTED] Checking hwmon presence...
[NOT DETECTED] Checking cursor...
[NOT DETECTED] Checking VMware registry...
[NOT DETECTED] Checking VBox registry...
[NOT DETECTED] Checking users...
[NOT DETECTED] Checking DLLs...
[NOT DETECTED] Checking registry...
[NOT DETECTED] Checking Sunbelt CWSandbox directory...
[NOT DETECTED] Checking Wine...
[NOT DETECTED] Checking VM files...
[NOT DETECTED] Checking hw.model...
[  DETECTED  ] Checking disk size...
[NOT DETECTED] Checking VBox default specs...
[NOT DETECTED] Checking VBox network provider match...
[NOT DETECTED] Checking computer name...
[NOT DETECTED] Checking hostname...
[  DETECTED  ] Checking low memory space...
[NOT DETECTED] Checking VM processes...
[NOT DETECTED] Checking default Linux user/host...
[NOT DETECTED] Checking VBox window class...
[NOT DETECTED] Checking gamarue ransomware technique...
[NOT DETECTED] Checking WMIC outputs...
[NOT DETECTED] Checking 0x4 leaf of VMID...
[NOT DETECTED] Checking Parallels techniques...
[NOT DETECTED] Checking RDTSC VMEXIT...
[NOT DETECTED] Checking loaded DLLs...
[NOT DETECTED] Checking QEMU CPU brand...
[NOT DETECTED] Checking BOCHS CPU techniques...
[NOT DETECTED] Checking VirtualPC motherboard...
[NOT DETECTED] Checking BIOS serial number...
[NOT DETECTED] Checking Hyper-V registry...
[NOT DETECTED] Checking Hyper-V WMI output...
[NOT DETECTED] Checking VirtualBox shared folders...
[NOT DETECTED] Checking VirtualBox MSSMBIOS...
[NOT DETECTED] Checking MacOS hw.memsize...
[NOT DETECTED] Checking MacOS registry IO-kit...
[NOT DETECTED] Checking IO registry grep...
[NOT DETECTED] Checking MacOS SIP...
[NOT DETECTED] Checking KVM registries...
[NOT DETECTED] Checking KVM drivers...
[NOT DETECTED] Checking KVM directories...
[NOT DETECTED] Checking HKLM registries...
[NOT DETECTED] Checking Audio device...
[NOT DETECTED] Checking qemu-ga process...
[NOT DETECTED] Checking MSR validity...
[NOT DETECTED] Checking QEMU processes...
[NOT DETECTED] Checking QEMU directories...
[NOT DETECTED] Checking VPC processes...
[NOT DETECTED] Checking VPC invalid instructions...
[NOT DETECTED] Checking SIDT...
[NOT DETECTED] Checking SGDT...
[NOT DETECTED] Checking SLDT...
[NOT DETECTED] Checking Offensive Security SIDT...
[NOT DETECTED] Checking Offensive Security SGDT...
[NOT DETECTED] Checking Offensive Security SLDT...
[NOT DETECTED] Checking Hyper-V motherboard...
[NOT DETECTED] Checking Extra VM files...

VM brand: QEMU
VM certainty: 100%
VM confirmation: true

====== CONCLUSION: Running inside a QEMU VM ======
kernelwernel commented 4 months ago

Ok good, thanks for being patient :)