Skip to content

migration: Fix migration state reference counting

Fabiano Rosas qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5migration: Fix use-after-free of migration state objectmigration/migration.c+2 -05 replies
2/5migration: Take reference to migration state around bg_migration_vm_start_bhmigration/migration.c+2 -00 replies
3/5migration: Reference migration state around loadvm_postcopy_handle_run_bhmigration/savevm.c+2 -00 replies
4/5migration: Add a wrapper to qemu_bh_schedulemigration/migration.c+14 -170 replies
5/5migration: Centralize BH creation and dispatchmigration/migration.c migration/migration.h migration/savevm.c+40 -370 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] migration: Fix migration state reference counting

We currently have a bug when running migration code in bottom halves. The issue has already been reported in Gitlab[1] and it started happening very frequently on my machine for some reason.

The issue is that we're dropping the last reference to the MigrationState object while the cleanup bottom half is still running and it leads to an use after free. More details on the commit message.

This series fixes the issue and does a refactoring around the migration BH scheduling aiming to consolidate some code so that it is less error prone.

1- https://gitlab.com/qemu-project/qemu/-/issues/1969

CI run: https://gitlab.com/farosas/qemu/-/pipelines/1144927625

Fabiano Rosas (5):
migration: Fix use-after-free of migration state object
migration: Take reference to migration state around
bg_migration_vm_start_bh
migration: Reference migration state around
loadvm_postcopy_handle_run_bh
migration: Add a wrapper to qemu_bh_schedule
migration: Centralize BH creation and dispatch

 migration/migration.c | 82 +++++++++++++++++++++++++------------------
 migration/migration.h |  5 +--
 migration/savevm.c    |  5 +--
 3 files changed, 49 insertions(+), 43 deletions(-)
Signature · 1 line
2.35.3