diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2014-12-27 18:01:00 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-12-28 10:01:17 +0100 |
commit | efbeec7098eee2b3d2359d0cc24bbba0436e7f21 (patch) | |
tree | 6b90f8b272f263d093b2f40a3aa471030616bbe1 /lib/locking-selftest-rlock-hardirq.h | |
parent | a629df7eadffb03e6ce4a8616e62ea29fdf69b6b (diff) |
kvm: fix sorting of memslots with base_gfn == 0
Before commit 0e60b0799fed (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 0e60b0799fed 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>
Diffstat (limited to 'lib/locking-selftest-rlock-hardirq.h')
0 files changed, 0 insertions, 0 deletions