All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trieu Huynh <vikingtc4@gmail.com>
To: qemu-devel@nongnu.org
Cc: Trieu Huynh <vikingtc4@gmail.com>
Subject: [PATCH 0/1] migration/multifd: fix channel count TOCTOU race on cancel and retry
Date: Wed, 22 Apr 2026 23:12:01 +0700	[thread overview]
Message-ID: <20260422161202.34150-1-viking4@gmail.com> (raw)

From: Trieu Huynh <vikingtc4@gmail.com>

QEMU aborts on src during multifd migration when multifd-channels is
changed after migrate_cancel:

~ # qemu-system-x86_64: ../util/yank.c:107: yank_unregister_instance:
Assertion `QLIST_EMPTY(&entry->yankfns)' failed.
Aborted (core dumped)

Below is the backtrace:
#7  yank_unregister_instance (instance=0x7fffffffd870) at ../util/yank.c:107
#8  migration_cleanup (s=0x555557649d10) at ../migration/migration.c:1338
#9  migration_cleanup_bh (opaque=0x555557649d10) at ../migration/migration.c:1345
#10 migration_bh_dispatch_bh (opaque=0x7ffe500051d0) at ../migration/migration.c:350
#11 aio_bh_call (bh=0x7ffe5006d670) at ../util/async.c:173
#12 aio_bh_poll (ctx=0x555557649210) at ../util/async.c:220
#13 aio_dispatch (ctx=0x555557649210) at ../util/aio-posix.c:390
#14 aio_ctx_dispatch (source=0x555557649210) at ../util/async.c:365
...

Steps to reproduce:

* 1. Start VM on src
./qemu-system-x86_64 \
  -<other_options>

* 2. Start dest with -incoming defer
./qemu-system-x86_64 \
  -incoming defer \
  -<other_options>

* 3. Enable multifd with 4 channels on both src and dest
{ "execute": "qmp_capabilities" }
{ "execute": "migrate-set-capabilities",
  "arguments": {"capabilities": [{"capability": "multifd",
                                  "state": true}]} }
{ "execute": "migrate-set-parameters",
  "arguments": {"multifd-channels": 4} }
{ "execute": "migrate-incoming",
  "arguments": {"uri": "tcp:0:4444"} }

* 4. Trigger migration
** dest:
{ "execute": "migrate-incoming", "arguments": {"uri": "tcp:0:4444"} }
** src:
{ "execute": "migrate", "arguments": {"uri": "tcp:127.0.0.1:4444"} }

* 5. Cancel migration on src while status is active
{ "execute": "migrate_cancel" }

* 6. Immediately change multifd-channels to 2 on src
{ "execute": "migrate-set-parameters",
  "arguments": {"multifd-channels": 2} }

QEMU aborts as shown above

Trieu Huynh (1):
  migration/multifd: fix channel count TOCTOU race on cancel and retry

 migration/multifd.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

-- 
2.43.0



             reply	other threads:[~2026-04-22 16:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-22 16:12 Trieu Huynh [this message]
2026-04-22 16:12 ` [PATCH 1/1] migration/multifd: fix channel count TOCTOU race on cancel and retry Trieu Huynh
2026-04-22 22:30   ` Fabiano Rosas
2026-04-23 16:14     ` Peter Xu
2026-04-23 18:13       ` Fabiano Rosas
2026-04-23 18:44         ` Peter Xu
2026-04-23 19:41           ` Fabiano Rosas
2026-04-24 13:53             ` Peter Xu
2026-04-24 14:15               ` Fabiano Rosas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260422161202.34150-1-viking4@gmail.com \
    --to=vikingtc4@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.