]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
KVM: Fix missing smp tlb flush in invlpg
authorAndrea Arcangeli <aarcange@redhat.com>
Fri, 17 Apr 2009 22:40:06 +0000 (19:40 -0300)
committerChris Wright <chrisw@sous-sol.org>
Mon, 27 Apr 2009 17:37:03 +0000 (10:37 -0700)
commitfda28853bc4bc053ef2fafb5c7d2a26e6ce4b4bf
tree53f4fc04bddb688d7c10fc0e93cd2972078302ec
parent35fe207a082d775b0bbaac3f49a9dc2d7c02779c
KVM: Fix missing smp tlb flush in invlpg

upstream commit: 4539b35881ae9664b0e2953438dd83f5ee02c0b4

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: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
[mtosatti: backport to 2.6.29]
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
arch/x86/kvm/paging_tmpl.h