-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fel: Try to detect VM environments and print a warning for those #98
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acked-by: Siarhei Siamashka siarhei.siamashka@gmail.com
It would be nice if @kotc could test it in his VM.
libusb_device **usb; | ||
struct libusb_device_descriptor desc; | ||
|
||
libusb_init(&ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check for error code from libusb_init()
too? http://libusb.sourceforge.net/api-1.0/group__lib.html#ga9517c37281bba0b51cc62eba728be48b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you check the hypervisor CPUID bit instead? ECX[bit 31] with EAX=1? AFAIK at least Xen and KVM set it, not sure about VMware, though.
Tested-By: @kotc tested in virtualbox@win7_64 (debian64 gues), vm was detected and warning printed ok @apritzel: yeah, in cpuinfo: flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc rep_good nopl pni ssse3 sse4_1 hypervisor lahf_lm |
Should we merge this as-is or try to implement @apritzel's suggestion? |
Okay, I will push this to the master branch in a few days. |
We try to detect virtual machines by parsing the vendor IDs of all USB devices, and will print a warning message if such an environment is encountered.