]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: Make locked operations truly atomic
authorAvi Kivity <avi@redhat.com>
Mon, 15 Mar 2010 11:59:54 +0000 (13:59 +0200)
committerAvi Kivity <avi@redhat.com>
Mon, 17 May 2010 09:15:39 +0000 (12:15 +0300)
commitd6ef62acefa1f7de990a4e5041b8952a2dde6742
treef6bf34cb9ad1e4ec85c8ef2a11ddee9d24c73d9a
parente702a2222c173bc00e3e032fc50021425165dbab
KVM: Make locked operations truly atomic

Once upon a time, locked operations were emulated while holding the mmu mutex.
Since mmu pages were write protected, it was safe to emulate the writes in
a non-atomic manner, since there could be no other writer, either in the
guest or in the kernel.

These days emulation takes place without holding the mmu spinlock, so the
write could be preempted by an unshadowing event, which exposes the page
to writes by the guest.  This may cause corruption of guest page tables.

Fix by using an atomic cmpxchg for these operations.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/x86.c