]> git.proxmox.com Git - mirror_qemu.git/commit
exec: fix access to ram_list.dirty_memory when sync dirty bitmap
authorHaozhong Zhang <haozhong.zhang@intel.com>
Wed, 28 Jun 2017 08:37:04 +0000 (16:37 +0800)
committerJuan Quintela <quintela@redhat.com>
Wed, 28 Jun 2017 10:23:58 +0000 (12:23 +0200)
commit084140bd4989095d39978269fd0f43e398a0015d
tree4a18368c0195ba881a42018767d4385f4a30c76f
parentc788ada8163127d20505e3ebf9b8735ba313d661
exec: fix access to ram_list.dirty_memory when sync dirty bitmap

In cpu_physical_memory_sync_dirty_bitmap(rb, start, ...), the 2nd
argument 'start' is relative to the start of the ramblock 'rb'. When
it's used to access the dirty memory bitmap of ram_list (i.e.
ram_list.dirty_memory[DIRTY_MEMORY_MIGRATION]->blocks[]), an offset to
the start of all RAM (i.e. rb->offset) should be added to it, which has
however been missed since c/s 6b6712efcc. For a ramblock of host memory
backend whose offset is not zero, cpu_physical_memory_sync_dirty_bitmap()
synchronizes the incorrect part of the dirty memory bitmap of ram_list
to the per ramblock dirty bitmap. As a result, a guest with host
memory backend may crash after migration.

Fix it by adding the offset of ramblock when accessing the dirty memory
bitmap of ram_list in cpu_physical_memory_sync_dirty_bitmap().

Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Message-Id: <20170628083704.24997-1-haozhong.zhang@intel.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Tested-by: Juan Quintela <quintela@redhat.com>
Tested-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
include/exec/ram_addr.h