linux-stable/virt/kvm
Paolo Bonzini efbeec7098 kvm: fix sorting of memslots with base_gfn == 0
Before commit 0e60b0799f (kvm: change memslot sorting rule from size
to GFN, 2014-12-01), the memslots' sorting key was npages, meaning
that a valid memslot couldn't have its sorting key equal to zero.
On the other hand, a valid memslot can have base_gfn == 0, and invalid
memslots are identified by base_gfn == npages == 0.

Because of this, commit 0e60b0799f broke the invariant that invalid
memslots are at the end of the mslots array.  When a memslot with
base_gfn == 0 was created, any invalid memslot before it were left
in place.

This can be fixed by changing the insertion to use a ">=" comparison
instead of "<=", but some care is needed to avoid breaking the case
of deleting a memslot; see the comment in update_memslots.

Thanks to Tiejun Chen for posting an initial patch for this bug.

Reported-by: Jamie Heilman <jamie@audible.transient.net>
Reported-by: Andy Lutomirski <luto@amacapital.net>
Tested-by: Jamie Heilman <jamie@audible.transient.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-12-28 10:01:17 +01:00
..
arm 3.19 changes for KVM: 2014-12-18 16:05:28 -08:00
async_pf.c kvm: Faults which trigger IO release the mmap_sem 2014-09-24 14:07:54 +02:00
async_pf.h KVM: Halt vcpu if page it tries to access is swapped out 2011-01-12 11:21:39 +02:00
coalesced_mmio.c KVM: return an error code in kvm_vm_ioctl_register_coalesced_mmio() 2014-01-30 11:56:09 +01:00
coalesced_mmio.h KVM: Make coalesced mmio use a device per zone 2011-09-25 19:17:57 +03:00
eventfd.c kvm: x86: move ioapic.c and irq_comm.c back to arch/x86/ 2014-11-21 18:02:37 +01:00
iodev.h KVM: remove in_range from io devices 2009-09-10 08:33:05 +03:00
irqchip.c KVM: Move irq notifier implementation into eventfd.c 2014-08-05 14:26:24 +02:00
Kconfig KVM: Give IRQFD its own separate enabling Kconfig option 2014-08-05 14:26:28 +02:00
kvm_main.c kvm: fix sorting of memslots with base_gfn == 0 2014-12-28 10:01:17 +01:00
vfio.c kvm: vfio: fix unregister kvm_device_ops of vfio 2014-10-24 13:30:47 +02:00
vfio.h kvm: vfio: fix unregister kvm_device_ops of vfio 2014-10-24 13:30:47 +02:00