• Andrea Arcangeli's avatar
    KVM: Fix missing smp tlb flush in invlpg · 4539b358
    Andrea Arcangeli authored
    When kvm emulates an invlpg instruction, it can drop a shadow pte, but
    leaves the guest tlbs intact.  This can cause memory corruption when
    swapping out.
    
    Without this the other cpu can still write to a freed host physical page.
    tlb smp flush must happen if rmap_remove is called always before mmu_lock
    is released because the VM will take the mmu_lock before it can finally add
    the page to the freelist after swapout. mmu notifier makes it safe to flush
    the tlb after freeing the page (otherwise it would never be safe) so we can do
    a single flush for multiple sptes invalidated.
    
    Cc: stable@kernel.org
    Signed-off-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
    Acked-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
    Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
    4539b358
paging_tmpl.h 15.4 KB