-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page tables translation API #96
Comments
Hi @Wenzel! Great to hear that you like my blog and this crate!
Could you clarify what you're trying to do and which functionality is missing? The problem with translating a virtual to a physical address is that you need to have access to the page tables, which you only have if the tables are mapped into the virtual address space somehow. Depending on this mapping, the I hope this clears things up! |
The hypervisor provides me with a direct access to the physical memory. I would like to share a function This function would translate a given status_t v2p_ia32e (vmi_instance_t vmi,
addr_t dtb,
addr_t vaddr,
page_info_t *info)
{ Now I see that I was looking at a function in one of your modules, but your structures have implementations too. If I would like to translate a virtual address from page tables implemented by modern Linux kernels and |
When using a hypervisor, there are typically three types of addresses (depending on the hypervisor):
You need to keep these address differences in mind when walking page tables. For example, the guest page tables point to guest physical addresses while the hypervisor page tables point to host physical addresses. The question is: Should your |
@phil-opp |
@Wenzel Ok, then you need to traverse guest page tables. I assume you want to do this from a distinct process/VM? Then you need to read the (virtualized) CR3 register of the guest, which points to the guest physical address of the level 4 page table. In order to walk this page table, your VM needs to obtain access to it through some hypervisor function, which means that the corresponding host physical frame is mapped into the virtual address space of the introspecting process/VM. Then you can read the the guest physical address of the level 3 page table and repeat the process. Instead of mapping each page seperately, you can also map the complete guest physical address space of the monitored process/VM at some offset into the virtual address space of the introspecting process/VM. Then you can use the offset technique described on the blog. I hope this helps! |
Closing this as inactive. I'm happy to reopen in case this is not resolved yet. |
Hi !
I'm considering using your crate to use a standard definition of the page tables in my project.
My goal is to do low-level Virtual Machine Introspection (VMI) on Xen, KVM, VirtualBox or Hyper-V with a Rust API (libmicrovmi)
Given that these hypervisors provide an API to read physical memory, the next step for me is to expose an API to read from a virtual address.
I can see that you already provide a standard definition of these paging structures for x86_64:
https://docs.rs/x86_64/0.7.6/x86_64/structures/paging/index.html
That's great !
But I was wondering how we could both avoid reinventing the wheel and share the same page tables parsing code to translate a virtual address to a physical one ?
Note: I found this crate by reading the excellent blog from Philipp Oppermann, Writing an OS in Rust !
An article was detailing the page table implementation using the x86_64 crate.
cc @phil-opp
Related: Wenzel/libmicrovmi#31
Thanks !
The text was updated successfully, but these errors were encountered: