From: Fabiano Rosas <farosas@suse.de>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Peter Xu <peterx@redhat.com>, Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH 2/8] tests/qtest/migration: Change validate_uuid test to not trigger exit(1)
Date: Tue, 10 Mar 2026 10:55:34 -0300 [thread overview]
Message-ID: <20260310135540.8679-2-farosas@suse.de> (raw)
In-Reply-To: <20260310135540.8679-1-farosas@suse.de>
The UUID validation happens early enough during the migration process
that the incoming coroutine hasn't yet yielded once so the
EXIT_FAILURE from the coroutine can trigger ASAN leak detection due to
the temporary socket from qio_net_listener_channel_func() still having
an elevated refcount.
Direct leak of 400 byte(s) in 1 object(s) allocated from:
#0 0x55e668890a07 in malloc asan_malloc_linux.cpp:68:3
#1 0x7f3c7e2b6648 in g_malloc ../glib/gmem.c:130
#2 0x55e66a8ef05f in object_new_with_type ../qom/object.c:767:15
#3 0x55e66a8ef178 in object_new ../qom/object.c:789:12
#4 0x55e66a93bcc6 in qio_channel_socket_new ../io/channel-socket.c:70:31
#5 0x55e66a93f34f in qio_channel_socket_accept ../io/channel-socket.c:401:12
#6 0x55e66a96752a in qio_net_listener_channel_func ../io/net-listener.c:64:12
#7 0x55e66a94bdac in qio_channel_fd_source_dispatch ../io/channel-watch.c:84:12
#8 0x7f3c7e2adf4b in g_main_dispatch ../glib/gmain.c:3476
#9 0x7f3c7e2adf4b in g_main_context_dispatch_unlocked ../glib/gmain.c:4284
#10 0x7f3c7e2b00c8 in g_main_context_dispatch ../glib/gmain.c:4272
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x55e668890a07 in malloc asan_malloc_linux.cpp:68:3
#1 0x7f3c7e2b6648 in g_malloc ../glib/gmem.c:130
#2 0x7f3c7e2ad40c in g_source_set_callback ../glib/gmain.c:1879
#3 0x55e66a95c4d2 in qio_channel_add_watch_full ../io/channel.c:416:5
#4 0x55e66a95c5a9 in qio_channel_add_watch_source ../io/channel.c:444:10
#5 0x55e66a96380c in qio_net_listener_watch ../io/net-listener.c:166:46
#6 0x55e66a96496a in qio_net_listener_set_client_func_internal ../io/net-listener.c:275:5
#7 0x55e66a963e79 in qio_net_listener_set_client_func_full ../io/net-listener.c:284:5
#8 0x55e669e1b3bb in socket_connect_incoming ../migration/socket.c:165:5
#9 0x55e669d26b9f in migration_connect_incoming ../migration/channel.c:83:13
#10 0x55e669d5f6d2 in qemu_setup_incoming_migration ../migration/migration.c:672:5
#11 0x55e669d5f344 in qmp_migrate_incoming ../migration/migration.c:1771:5
This is inconsequential in production, but let's give ourselves an
easier time and avoid this situation when testing. The uuid_error test
doesn't really need to check the exit code, just the migration state
would be sufficient. Set exit-on-error=false for this test.
While looking at this, add a comment to the source explaining that the
incoming coroutine may block the main loop for a (longer than
expected) while.
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
migration/migration.c | 5 +++++
tests/qtest/migration/misc-tests.c | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index f949708629..c77832f851 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -898,6 +898,11 @@ void migration_start_incoming(void)
Coroutine *co = qemu_coroutine_create(process_incoming_migration_co, NULL);
qemu_coroutine_enter(co);
+ /*
+ * This doesn't return right away. The coroutine will run
+ * unimpeded until its first yield, which may happen as late as
+ * the force yield at ram_load_precopy().
+ */
}
int migrate_send_rp_switchover_ack(MigrationIncomingState *mis)
diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/misc-tests.c
index 810e9e6549..06da2657d5 100644
--- a/tests/qtest/migration/misc-tests.c
+++ b/tests/qtest/migration/misc-tests.c
@@ -131,7 +131,7 @@ static void do_test_validate_uuid(MigrateStart *args, bool should_fail)
g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
QTestState *from, *to;
- if (migrate_start(&from, &to, uri, args)) {
+ if (migrate_start(&from, &to, "defer", args)) {
return;
}
@@ -146,10 +146,10 @@ static void do_test_validate_uuid(MigrateStart *args, bool should_fail)
/* Wait for the first serial output from the source */
wait_for_serial("src_serial");
+ migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }");
migrate_qmp(from, to, uri, NULL, "{}");
if (should_fail) {
- qtest_set_expected_status(to, EXIT_FAILURE);
wait_for_migration_fail(from, true);
} else {
wait_for_migration_complete(from);
--
2.51.0
next prev parent reply other threads:[~2026-03-10 13:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 13:55 [PATCH 1/8] tests/qtest/migration: Fix leak of migration tests data Fabiano Rosas
2026-03-10 13:55 ` Fabiano Rosas [this message]
2026-03-10 19:59 ` [PATCH 2/8] tests/qtest/migration: Change validate_uuid test to not trigger exit(1) Peter Xu
2026-03-11 10:34 ` Prasad Pandit
2026-03-10 13:55 ` [PATCH 3/8] tests/qtest/migration: Fix misuse of listen_uri Fabiano Rosas
2026-03-10 15:48 ` Lukas Straub
2026-03-10 13:55 ` [PATCH 4/8] tests/qtest/migration: Stop invoking migrate_incoming from hooks Fabiano Rosas
2026-03-10 15:47 ` Lukas Straub
2026-03-10 13:55 ` [PATCH 5/8] tests/qtest/migration: Force exit-on-error=false when appropriate Fabiano Rosas
2026-03-10 20:46 ` Peter Xu
2026-03-10 21:14 ` Fabiano Rosas
2026-03-11 10:36 ` Prasad Pandit
2026-03-11 15:40 ` Peter Xu
2026-03-10 13:55 ` [PATCH 6/8] io: Fix TLS bye task leak Fabiano Rosas
2026-03-10 14:29 ` Daniel P. Berrangé
2026-03-10 13:55 ` [PATCH 7/8] tests/qtest/migration: Fix leak in CPR exec test Fabiano Rosas
2026-03-10 20:46 ` Peter Xu
2026-03-11 9:56 ` Prasad Pandit
2026-03-10 13:55 ` [PATCH 8/8] migration/multifd: Fix leaks of TLS error objects Fabiano Rosas
2026-03-10 20:49 ` Peter Xu
2026-03-11 9:32 ` Prasad Pandit
2026-03-10 19:47 ` [PATCH 1/8] tests/qtest/migration: Fix leak of migration tests data Peter Xu
2026-03-11 11:56 ` Prasad Pandit
2026-03-11 12:57 ` 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=20260310135540.8679-2-farosas@suse.de \
--to=farosas@suse.de \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.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.