qemu/migration
Peter Xu 4daff81efb migration: Check current_migration in migration_is_running()
Report shows that commit 34a8892dec broke iotest 055:

https://lore.kernel.org/r/b8806360-a2b6-4608-83a3-db67e264c733@linaro.org

Denis Rastyogin reported more such issue:

https://lore.kernel.org/r/20241107114256.106831-1-gerben@altlinux.org

  In this merge, the migration_is_idle() function was replaced with
  migrate_is_running().  However, the null pointer check for `s` was
  removed, leading to a dereference of `s` when using qemu-system-x86_64
  -hda *.vdi.

When replacing migration_is_idle() with "!migration_is_running()", it was
overlooked that the idle helper also checks for current_migration being
available first.  Sample stack dump:

 migration_is_running
 is_busy
 migrate_add_blocker_modes
 migrate_add_blocker_normal
 vmdk_open
 bdrv_open_driver
 bdrv_open_common
 bdrv_open_inherit
 bdrv_open
 blk_new_open
 blockdev_init
 drive_new
 drive_init_func
 qemu_opts_foreach
 configure_blockdev
 qemu_create_early_backends
 qemu_init
 main

The check would be there if the whole series was applied, but since the
last patches in the previous series rely on some other patches to land
first, we need to recover the behavior of migration_is_idle() first before
that whole set will be merged.

I left migration_is_active / migration_is_device alone, as I don't think
it's possible for them to hit uninitialized current_migration. Also they're
prone to removal soon from VFIO side.

Cc: Peter Maydell <peter.maydell@linaro.org>
Fixes: 34a8892dec ("migration: Drop migration_is_idle()")
Reported-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reported-by: Denis Rastyogin <gerben@altlinux.org>
Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20241105182725.2393425-1-peterx@redhat.com
[peterx: enhance commit msg]
Signed-off-by: Peter Xu <peterx@redhat.com>
2024-11-13 13:02:45 -05:00
..
block-dirty-bitmap.c
channel-block.c
channel-block.h
channel.c
channel.h
colo-failover.c
colo-stubs.c migration/colo: make colo_incoming_co() return void 2024-05-22 17:34:31 -03:00
colo.c migration: Put thread names together with macros 2024-10-31 15:48:18 -04:00
cpu-throttle.c migration: Support periodic RAMBlock dirty bitmap sync 2024-10-31 15:48:18 -04:00
dirtyrate.c migration/dirtyrate: Silence warning about strcpy() on OpenBSD 2024-10-31 15:48:18 -04:00
dirtyrate.h
exec.c
exec.h
fd.c migration: Deprecate fd: for file migration 2024-05-08 09:20:59 -03:00
fd.h
file.c migration/multifd: Pass in MultiFDPages_t to file_write_ramblock_iov 2024-09-03 16:24:35 -03:00
file.h migration/multifd: Pass in MultiFDPages_t to file_write_ramblock_iov 2024-09-03 16:24:35 -03:00
global_state.c
meson.build migration: Move cpu-throttle.c from system to migration 2024-10-31 15:48:18 -04:00
migration-hmp-cmds.c migration: replace assert(0) with g_assert_not_reached() 2024-09-24 13:53:35 +02:00
migration-stats.c
migration-stats.h
migration.c migration: Check current_migration in migration_is_running() 2024-11-13 13:02:45 -05:00
migration.h migration: Unexport dirty_bitmap_mig_init() 2024-10-31 15:48:18 -04:00
multifd-nocomp.c migration/multifd: Ensure packet->ramblock is null-terminated 2024-10-08 15:28:55 -04:00
multifd-qatzip.c migration/multifd: Fix build for qatzip 2024-09-17 17:50:45 -04:00
multifd-qpl.c migration/multifd: fix build error when qpl compression is enabled 2024-10-09 08:30:53 -04:00
multifd-uadk.c migration/multifd: Fix p->iov leak in multifd-uadk.c 2024-09-03 16:24:36 -03:00
multifd-zero-page.c migration/multifd: Move pages accounting into multifd_send_zero_page_detect() 2024-09-03 16:24:35 -03:00
multifd-zlib.c migration/multifd: Make MultiFDMethods const 2024-09-03 16:24:36 -03:00
multifd-zstd.c migration/multifd: Fix loop conditions in multifd_zstd_send_prepare and multifd_zstd_recv 2024-09-18 14:27:24 -04:00
multifd.c migration/multifd: Zero p->flags before starting filling a packet 2024-10-31 15:48:18 -04:00
multifd.h migration: Introduce 'qatzip' compression method 2024-09-09 10:55:40 -04:00
options.c migration: Deprecate zero-blocks capability 2024-10-08 15:28:55 -04:00
options.h migration: Remove unused migrate_zero_blocks 2024-10-08 15:28:55 -04:00
page_cache.c
page_cache.h
postcopy-ram.c migration: Put thread names together with macros 2024-10-31 15:48:18 -04:00
postcopy-ram.h migration/postcopy: Add postcopy-recover-setup phase 2024-06-21 09:47:59 -03:00
qemu-file.c migration: remove unnecessary zlib dependency 2024-05-25 13:28:02 +02:00
qemu-file.h migration: Remove non-multifd compression 2024-05-08 09:20:59 -03:00
ram.c migration/ram: Add load start trace event 2024-10-31 15:48:18 -04:00
ram.h migration: Unexport ram_mig_init() 2024-10-31 15:48:18 -04:00
rdma.c
rdma.h
savevm.c * Various bug fixes 2024-11-05 10:05:59 +00:00
savevm.h
socket.c migration: Remove unused socket_send_channel_create_sync 2024-10-08 15:28:55 -04:00
socket.h migration: Remove unused socket_send_channel_create_sync 2024-10-08 15:28:55 -04:00
target.c
threadinfo.c
threadinfo.h
tls.c
tls.h
trace-events migration/ram: Add load start trace event 2024-10-31 15:48:18 -04:00
trace.h
vmstate-types.c
vmstate.c migration: Ensure vmstate_save() sets errp 2024-10-31 15:48:18 -04:00
xbzrle.c
xbzrle.h
yank_functions.c
yank_functions.h