Ali Tarhini
Ali Tarhini

Reputation: 5358

How to detect if an application is running under KVM?

I already know how to detect VMWare and VirtualPC, but I want to know how to do this in Kernel Virtual Machine. I would like the code to be in C or C++.

Upvotes: 1

Views: 2115

Answers (1)

unwind
unwind

Reputation: 399833

This page implies that it's enough to check the kernel's boot messages, if Linux is your hosted OS:

 # dmesg | grep -i virtual
 CPU: AMD QEMU Virtual CPU version 0.9.1 stepping 03

That should be easy enough to implement in C.

Upvotes: 1

Related Questions