Apply d->memslot->partial_roe_bitmap to shadow page table entries
too.

Signed-off-by: Ahmed Abd El Mawgood <ahmedsoliman0x...@gmail.com>
---
 arch/x86/kvm/roe.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/roe.c b/arch/x86/kvm/roe.c
index cd3e6944c15f..b2b50fbcd598 100644
--- a/arch/x86/kvm/roe.c
+++ b/arch/x86/kvm/roe.c
@@ -25,9 +25,12 @@ static bool __rmap_write_protect_roe(struct kvm *kvm,
        struct rmap_iterator iter;
        bool prot;
        bool flush = false;
+       void *full_bmp =  d->memslot->roe_bitmap;
+       void *part_bmp = d->memslot->partial_roe_bitmap;
 
        for_each_rmap_spte(rmap_head, &iter, sptep) {
-               prot = !test_bit(d->i, d->memslot->roe_bitmap) && pt_protect;
+               prot = !(test_bit(d->i, full_bmp) || test_bit(d->i, part_bmp));
+               prot = prot && pt_protect;
                flush |= spte_write_protect(sptep, prot);
                d->i++;
        }
-- 
2.18.1

Reply via email to