From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: dgilbert@redhat.com, lvivier@redhat.com, peterx@redhat.com,
"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [Qemu-devel] [PULL 16/16] migration: fix crash in when incoming client channel setup fails
Date: Wed, 27 Jun 2018 14:56:04 +0200 [thread overview]
Message-ID: <20180627125604.15275-17-quintela@redhat.com> (raw)
In-Reply-To: <20180627125604.15275-1-quintela@redhat.com>
From: Daniel P. Berrangé <berrange@redhat.com>
The way we determine if we can start the incoming migration was
changed to use migration_has_all_channels() in:
commit 428d89084c709e568f9cd301c2f6416a54c53d6d
Author: Juan Quintela <quintela@redhat.com>
Date: Mon Jul 24 13:06:25 2017 +0200
migration: Create migration_has_all_channels
This method in turn calls multifd_recv_all_channels_created()
which is hardcoded to always return 'true' when multifd is
not in use. This is a latent bug...
...activated in a following commit where that return result
ends up acting as the flag to indicate whether it is possible
to start processing the migration:
commit 36c2f8be2c4eb0003ac77a14910842b7ddd7337e
Author: Juan Quintela <quintela@redhat.com>
Date: Wed Mar 7 08:40:52 2018 +0100
migration: Delay start of migration main routines
This means that if channel initialization fails with normal
migration, it'll never notice and attempt to start the
incoming migration regardless and crash on a NULL pointer.
This can be seen, for example, if a client connects to a server
requiring TLS, but has an invalid x509 certificate:
qemu-system-x86_64: The certificate hasn't got a known issuer
qemu-system-x86_64: migration/migration.c:386: process_incoming_migration_co: Assertion `mis->from_src_file' failed.
#0 0x00007fffebd24f2b in raise () at /lib64/libc.so.6
#1 0x00007fffebd0f561 in abort () at /lib64/libc.so.6
#2 0x00007fffebd0f431 in _nl_load_domain.cold.0 () at /lib64/libc.so.6
#3 0x00007fffebd1d692 in () at /lib64/libc.so.6
#4 0x0000555555ad027e in process_incoming_migration_co (opaque=<optimized out>) at migration/migration.c:386
#5 0x0000555555c45e8b in coroutine_trampoline (i0=<optimized out>, i1=<optimized out>) at util/coroutine-ucontext.c:116
#6 0x00007fffebd3a6a0 in __start_context () at /lib64/libc.so.6
#7 0x0000000000000000 in ()
To handle the non-multifd case, we check whether mis->from_src_file
is non-NULL. With this in place, the migration server drops the
rejected client and stays around waiting for another, hopefully
valid, client to arrive.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20180619163552.18206-1-berrange@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/migration.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/migration/migration.c b/migration/migration.c
index d075c27886..94d71f8b24 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -518,11 +518,12 @@ void migration_ioc_process_incoming(QIOChannel *ioc)
*/
bool migration_has_all_channels(void)
{
+ MigrationIncomingState *mis = migration_incoming_get_current();
bool all_channels;
all_channels = multifd_recv_all_channels_created();
- return all_channels;
+ return all_channels && mis->from_src_file != NULL;
}
/*
--
2.17.1
next prev parent reply other threads:[~2018-06-27 12:56 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-27 12:55 [Qemu-devel] [PULL 00/16] Migration Juan Quintela
2018-06-27 12:55 ` [Qemu-devel] [PULL 01/16] migration: Create multipage support Juan Quintela
2018-06-27 12:55 ` [Qemu-devel] [PULL 02/16] migration: Create multifd packet Juan Quintela
2018-06-27 12:55 ` [Qemu-devel] [PULL 03/16] migration: Calculate mbps only during transfer time Juan Quintela
2018-06-27 12:55 ` [Qemu-devel] [PULL 04/16] migration: Abstract the number of bytes sent Juan Quintela
2018-06-27 12:55 ` [Qemu-devel] [PULL 05/16] migration: Add multifd traces for start/end thread Juan Quintela
2018-06-27 12:55 ` [Qemu-devel] [PULL 06/16] migration: Multifd channels always wait on the sem Juan Quintela
2018-06-27 12:55 ` [Qemu-devel] [PULL 07/16] migration: Add block where to send/receive packets Juan Quintela
2018-06-27 12:55 ` [Qemu-devel] [PULL 08/16] migration: Synchronize multifd threads with main thread Juan Quintela
2018-06-27 12:55 ` [Qemu-devel] [PULL 09/16] migration: Create multifd_bytes ram_counter Juan Quintela
2018-06-27 12:55 ` [Qemu-devel] [PULL 10/16] migration: Create ram_save_multifd_page Juan Quintela
2018-07-06 10:57 ` Peter Maydell
2018-06-27 12:55 ` [Qemu-devel] [PULL 11/16] migration: Start sending messages Juan Quintela
2018-06-27 12:56 ` [Qemu-devel] [PULL 12/16] migration: Wait for blocking IO Juan Quintela
2018-06-27 12:56 ` [Qemu-devel] [PULL 13/16] migration: Remove not needed semaphore and quit Juan Quintela
2018-06-27 12:56 ` [Qemu-devel] [PULL 14/16] migration: Stop sending whole pages through main channel Juan Quintela
2018-06-27 12:56 ` [Qemu-devel] [PULL 15/16] postcopy: drop ram_pages parameter from postcopy_ram_incoming_init() Juan Quintela
2018-06-27 12:56 ` Juan Quintela [this message]
2018-06-28 9:55 ` [Qemu-devel] [PULL 16/16] migration: fix crash in when incoming client channel setup fails Balamuruhan S
2018-06-28 11:06 ` Juan Quintela
2018-06-29 9:11 ` Balamuruhan S
2018-06-28 15:28 ` [Qemu-devel] [PULL 00/16] Migration Peter Maydell
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=20180627125604.15275-17-quintela@redhat.com \
--to=quintela@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=lvivier@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).