Write bit in Shadow Page Table Entry
Hi,
As I understand, the KVM code (kvm-86) may clear the write bit when setting a shadow page table entry so that it can detect when an entry needs to be marked dirty later. However, it also plays with the write bit depending on whether the shadow page is allowed to be unsynched or not. I'm not quite clear on the latter, so if anyone can provide some insights it would be very much appreciated. Or perhaps even more helpful...if it is possible to provide a clear picture of how KVM generally plays with an entry's write bit.
Thank you!,
-Lynda Yang
Quoted 10 lines · Lynda Yang
Hi,
As I understand, the KVM code (kvm-86) may clear the write bit when setting a shadow page table entry so that it can detect when an entry needs to be marked dirty later. However, it also plays with the write bit depending on whether the shadow page is allowed to be unsynched or not. I'm not quite clear on the latter, so if anyone can provide some insights it would be very much appreciated. Or perhaps even more helpful...if it is possible to provide a clear picture of how KVM generally plays with an entry's write bit.
Let's see.
1. If the spte was derived from a guest pte, then the writeable bit reflects the guest permissions. If not (nested paging, real mode), the writeable bit is 1.
2. When we log dirty pages, writeable bits for the memory we are interested in are cleared.
3. If the spte points at a shadow page, the writeable bit is cleared to 0 so that we are informed of updates to page tables.
4. Under certain conditions[1], we allow a shadowed guest page table to be writeable. This happens on a write fault to a guest page table.
[1] The conditions are: the page is the lowest-level mapping, and there are no other uses of the page as a paging element.
Signature · 1 line
error compiling committee.c: too many arguments to function