kernel-fxtec-pro1x/virt/kvm
Takuya Yoshikawa 50e92b3c97 KVM: Fix __set_bit() race in mark_page_dirty() during dirty logging
It is possible that the __set_bit() in mark_page_dirty() is called
simultaneously on the same region of memory, which may result in only
one bit being set, because some callers do not take mmu_lock before
mark_page_dirty().

This problem is hard to produce because when we reach mark_page_dirty()
beginning from, e.g., tdp_page_fault(), mmu_lock is being held during
__direct_map():  making kvm-unit-tests' dirty log api test write to two
pages concurrently was not useful for this reason.

So we have confirmed that there can actually be race condition by
checking if some callers really reach there without holding mmu_lock
using spin_is_locked():  probably they were from kvm_write_guest_page().

To fix this race, this patch changes the bit operation to the atomic
version:  note that nr_dirty_pages also suffers from the race but we do
not need exactly correct numbers for now.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-02-01 11:42:32 +02:00
..
assigned-dev.c KVM: Device assignment permission checks 2011-12-25 19:03:54 +02:00
async_pf.c
async_pf.h
coalesced_mmio.c KVM: make checks stricter in coalesced_mmio_in_range() 2011-12-27 11:17:07 +02:00
coalesced_mmio.h KVM: Make coalesced mmio use a device per zone 2011-09-25 19:17:57 +03:00
eventfd.c KVM: Intelligent device lookup on I/O bus 2011-09-25 19:17:59 +03:00
ioapic.c KVM: drop bsp_vcpu pointer from kvm struct 2011-12-27 11:22:32 +02:00
ioapic.h
iodev.h
iommu.c module_param: make bool parameters really bool (drivers & misc) 2012-01-13 09:32:20 +10:30
irq_comm.c KVM: fast-path msi injection with irqfd 2011-01-12 11:29:38 +02:00
Kconfig
kvm_main.c KVM: Fix __set_bit() race in mark_page_dirty() during dirty logging 2012-02-01 11:42:32 +02:00