]> git.proxmox.com Git - pve-qemu.git/commit - debian/patches/pve/0049-PVE-savevm-async-register-yank-before-migration_inco.patch
savevm-async: avoid segfault when aborting snapshot
authorFiona Ebner <f.ebner@proxmox.com>
Thu, 18 Aug 2022 11:44:16 +0000 (13:44 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 19 Aug 2022 07:44:14 +0000 (09:44 +0200)
commit563c59289808696288565267b49a1c742d88504e
tree37d94ae34f43468c7b06b238b7ef037a121c0f8a
parent1de53d8a450d01fe15323fd55bb33059ab7fbe20
savevm-async: avoid segfault when aborting snapshot

Reported in the community forum[0].

For 6.1.0, there were a few changes to the coroutine-sleep API, but
the adaptations in f376b2b ("update and rebase to QEMU v6.1.0") made
a mistake.

Currently, target_close_wait is NULL when passed to
qemu_co_sleep_ns_wakeable(), which further passes it to
qemu_co_sleep(), but there, it is dereferenced when trying to access
the 'to_wake' member:

> Thread 1 "kvm" received signal SIGSEGV, Segmentation fault.
> qemu_co_sleep (w=0x0) at ../util/qemu-coroutine-sleep.c:57

To fix it, create a proper struct and pass its address instead. Also
call qemu_co_sleep_wake unconditionally, because the NULL check (for
the 'to_wake' member) is done inside the function itself.

This patch is based on what the QEMU commits introducing the changes
to the coroutine-sleep API did to the callers in QEMU:
eaee072085 ("coroutine-sleep: allow qemu_co_sleep_wake that wakes nothing")
29a6ea24eb ("coroutine-sleep: replace QemuCoSleepState pointer with struct in the API")

[0]: https://forum.proxmox.com/threads/112130/

Tested-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
debian/patches/pve/0016-PVE-add-savevm-async-for-background-state-snapshots.patch
debian/patches/pve/0017-PVE-add-optional-buffer-size-to-QEMUFile.patch
debian/patches/pve/0049-PVE-savevm-async-register-yank-before-migration_inco.patch