Skip to content

Commit c066faf

Browse files
committed
KVM: PPC: Book3S HV: Use correct pagesize in kvm_unmap_radix()
Since commit e641a31 ("KVM: PPC: Book3S HV: Unify dirty page map between HPT and radix", 2017-10-26), kvm_unmap_radix() computes the number of PAGE_SIZEd pages being unmapped and passes it to kvmppc_update_dirty_map(), which expects to be passed the page size instead. Consequently it will only mark one system page dirty even when a large page (for example a THP page) is being unmapped. The consequence of this is that part of the THP page might not get copied during live migration, resulting in memory corruption for the guest. This fixes it by computing and passing the page size in kvm_unmap_radix(). Cc: [email protected] # v4.15+ Fixes: e641a31 (KVM: PPC: Book3S HV: Unify dirty page map between HPT and radix) Signed-off-by: Paul Mackerras <[email protected]>
1 parent fd8ca6d commit c066faf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/powerpc/kvm/book3s_64_mmu_radix.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -738,10 +738,10 @@ int kvm_unmap_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
738738
gpa, shift);
739739
kvmppc_radix_tlbie_page(kvm, gpa, shift);
740740
if ((old & _PAGE_DIRTY) && memslot->dirty_bitmap) {
741-
unsigned long npages = 1;
741+
unsigned long psize = PAGE_SIZE;
742742
if (shift)
743-
npages = 1ul << (shift - PAGE_SHIFT);
744-
kvmppc_update_dirty_map(memslot, gfn, npages);
743+
psize = 1ul << shift;
744+
kvmppc_update_dirty_map(memslot, gfn, psize);
745745
}
746746
}
747747
return 0;

0 commit comments

Comments
 (0)