KVM-VMI / kvm

Fork of KVM with Virtual Machine Introspection patches
Other
33 stars 28 forks source link

kvm: introspection: guest page mapping from host #56

Closed thomasdangl closed 1 year ago

thomasdangl commented 1 year ago

As discussed in https://github.com/KVM-VMI/kvm-vmi/issues/39#issuecomment-524815312, KVMi currently does not support mapping guest pages from the host.

This pull request implements this feature as follows:

  1. We make a new entry in the ProcFS available during the virtual machine introspection. The introspection library uses this file in conjunction with mmap. We remap the resulting pages to the guest's pages, similar to https://github.com/KVM-VMI/kvm/commit/b7177c0fa9b39642c1670845b8cb1792ba0d53da. However, the fact that we are mapping the guest pages on the host allows for optimizations over the approach for remote mapping.
  2. We add a new KVMI_VM_QUERY_PHYSICAL command that retrieves information about the backing memory slot for a given guest physical address. The idea behind this command is to enable seamless integration into libkvmi that can eventually provide a transparent API for page mapping (whether remote or host-local).

If this new functionality looks fine to you, I'm happy to send another pull request for integrating it into libkvmi and its caching system.

Best, Thomas

adlazar commented 1 year ago

It will be great if you can add selftests. @Wenzel has configured the CI system to run these tests to validate pull requests.

thomasdangl commented 1 year ago

Alright, will do so in the next days 👍

Wenzel commented 1 year ago

@thomasdangl the tests are triggered when a PR is opened on the root repo: https://github.com/KVM-VMI/kvm-vmi

You could update the submodule to point to your kvm fork, and check out your commit Then make a PR, and we can see how the CI runs.

thomasdangl commented 1 year ago

I sent a PR for the kvmi-v7 branch here (it includes the commits happening in master since the merge): https://github.com/KVM-VMI/kvm-vmi/pull/147

If you prefer the PR for the master branch, just let me know and I will create a new one : )

thomasdangl commented 1 year ago

Any updates on this?