@samitouri / QOSamiQemu / commits / 9d9d449180

dump: refuse dump-guest-memory while guest RAM is being migrated

dump-guest-memory reads all of guest RAM. The existing guard only rejects the dump in RUN_STATE_INMIGRATE, i.e. the precopy load phase. On a postcopy destination the guest already runs (RUN_STATE_RUNNING) while its pages are pulled from the source on demand. A non-detached dump reads that RAM on the main thread with the BQL held. Touching a not-yet-received page blocks on the userfault, and because the postcopy incoming path itself takes the BQL to install pages, the transfer that would satisfy the fault cannot progress: the VM deadlocks. Use migration_guest_ram_loading(), which also covers postcopy, so the dump is refused for the whole time the destination is still receiving guest RAM. Signed-off-by: Denis V. Lunev <den@openvz.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20260619101834.228432-3-den@openvz.org>

Denis V. Lunev committed Jun 19, 2026 at 12:18 UTC 9d9d449180f2f2589718a31292c8deaf9cf78ff3
1 file changed +3 -2
dump/dump.c
+3 -2
@@ -30,6 +30,7 @@
30 #include "qemu/main-loop.h"
31 #include "hw/misc/vmcoreinfo.h"
32 #include "migration/blocker.h"
33 +#include "migration/misc.h"
34 #include "hw/core/cpu.h"
35 #include "win_dump.h"
36 #include "qemu/range.h"
@@ -2080,8 +2081,8 @@ void qmp_dump_guest_memory(bool paging, const char *protocol,
2081 bool detach_p = false;
2082 bool kdump_raw = false;
2083
2083 - if (runstate_check(RUN_STATE_INMIGRATE)) {
2084 - error_setg(errp, "Dump not allowed during incoming migration.");
2084 + if (migration_guest_ram_loading()) {
2085 + error_setg(errp, "Dump not allowed during migration.");
2086 return;
2087 }
2088