tandasat / HyperPlatform

Intel VT-x based hypervisor aiming to provide a thin VM-exit filtering platform on Windows.
MIT License
1.51k stars 406 forks source link

Enhancement: Support for VMCS Shadowing #14

Open ionescu007 opened 8 years ago

ionescu007 commented 8 years ago

This would allow using hyperplatform while still enjoying the use of Virtual Box, VMWare, or other virtualization software (note that supporting Hyper-V would not be possible, as it enables the hypervisor at boot).

tandasat commented 8 years ago

Thanks for this proposal. Running with other hypervisors would be good enhancement. In order to assess amount of work and priority, can you tell me a couple of things?

  1. Do you think I can test a fix on a VMware VM that also run VMware or VirtualBox? As I do not have facility to debug a real device, it would be great if I can reproduce the issue and test a fix on a virtual machine.
  2. Do you know of any references can be helpful for researching and implementing the enhancement? I was not quite familiar with VMCS shadowing and thought it was only for implementing nested-VM. If you could tell me anything could be helpful for understanding the idea (ie, other project's source code, presentation slides etc), that would help me estimate amount of work and speed up development.
Zero-Tang commented 6 years ago

VMCS-shadowing allows hardware-accelerated support for vmread, vmwrite instructions, where VMCS fields can be stored in VMX-specific format, keeping VMM robust. It allows certain fields of VMCS reading/writing won't be intercepted by VMM, which means vmread and vmwrite instructions won't be VM-Exit of obligation. Since shadow-VMCS can be both read/written by VM and VMM, it becomes simple when it comes to analyze VMCS. To virtualize VM-Entry, vmlaunch and vmresume will be intercepted. Replace guest rip with guest rip in shadow-VMCS and execute vmresume. Perform source check is requried (e.g. guest has executed vmxon successfully, loaded VMCS successfully etc.) Note that msr-loading should be performed on emulated VM-Entry. To virtualize VM-Exit, replace guest rip with host rip in shadow-VMCS and execute vmresume. Note that msr-loading and msr-storing should be performed on emulated VM-Exit. Emulate a VMX-Abort if certain condition is met. For Intel EPT emulation, merge the page table.