Skip to content

fel: Try to detect VM environments and print a warning for those#98

Open
n1tehawk wants to merge 1 commit into
linux-sunxi:masterfrom
n1tehawk:20170213_detectvm
Open

fel: Try to detect VM environments and print a warning for those#98
n1tehawk wants to merge 1 commit into
linux-sunxi:masterfrom
n1tehawk:20170213_detectvm

Conversation

@n1tehawk

Copy link
Copy Markdown
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.

Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de>

@ssvb ssvb left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread fel_lib.c
libusb_device **usb;
struct libusb_device_descriptor desc;

libusb_init(&ctx);

Copy link
Copy Markdown
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

@apritzel apritzel left a comment

Copy link
Copy Markdown
Contributor

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

kotc commented Feb 27, 2017

Copy link
Copy Markdown

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

ssvb commented Mar 19, 2017

Copy link
Copy Markdown
Contributor

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

@ssvb

ssvb commented Nov 6, 2017

Copy link
Copy Markdown
Contributor

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