On Wed, Jun 28, 2017 at 04:37:04PM +0800, Haozhong Zhang wrote:
> 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 <stefa...@redhat.com>
> Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com>
> ---
> Changes in v2:
>  * Avoid shadowing variable 'offset'. (Paolo)
> ---
>  include/exec/ram_addr.h | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

Tested-by: Stefan Hajnoczi <stefa...@redhat.com>

Attachment: signature.asc
Description: PGP signature

Reply via email to