Skip to content

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