Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

n1tehawk
Copy link
Collaborator

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.

Copy link
Contributor

@ssvb ssvb left a 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 [email protected]

It would be nice if @kotc could test it in his VM.

libusb_device **usb;
struct libusb_device_descriptor desc;

libusb_init(&ctx);
Copy link
Contributor

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

Copy link
Contributor

@apritzel apritzel left a 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.

@kotc
Copy link

kotc commented Feb 27, 2017

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

@ssvb
Copy link
Contributor

ssvb commented Mar 19, 2017

Should we merge this as-is or try to implement @apritzel's suggestion?

@ssvb
Copy link
Contributor

ssvb commented Nov 6, 2017

Okay, I will push this to the master branch in a few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants