vmware-archive / vmw-guestinfo

Apache License 2.0
43 stars 20 forks source link

Collapse message.HypervisorPortCheck into vmcheck.IsVirtualWorld #8

Closed fdawg4l closed 7 years ago

fdawg4l commented 7 years ago

We still need to solve the PANIC issue. If run in a non-virtual world, the runtime will panic.

This is the last place which requires CGO in this package. I thought the benefit is worth the tradeoff.

fdawg4l commented 7 years ago

Ping @dougm and @caglar10ur.

sigma commented 7 years ago

I'm not sure I see the benefit here. IsVirtualWorld() is supposed to protect non-vmware environment from those backdoor-induced panic()s. I'd love to get rid of the cgo dependency, but given that programs would still have to use sigma/bdoor to be correct, that would still not achieve that goal.

fdawg4l commented 7 years ago

@sigma After quite a bit of googling, I figured out how to knock on the backdoor to test if it's there without causing a segfault.

Also, we now check the HV bit in the CPU ID as well as the extended CPU ID level for the Hypervisor string. After passing those checks, we knock the backdoor.

cc: @caglar10ur and @dougm

fdawg4l commented 7 years ago

@sigma I think this is as good as we're going to get it. I think iopl is the right way to go and gets us the best behavior without being too obscure. Please let me know if you want to see any more changes. Thanks!

fdawg4l commented 7 years ago

Done.

This change has LOTs of commits. Let's make good use of that Squash and Merge feature of GH. :-)