|
|
22c213 |
From 517a99c5fba163bf684978fe3d9476b619481391 Mon Sep 17 00:00:00 2001
|
|
|
22c213 |
From: Juan Quintela <quintela@redhat.com>
|
|
|
22c213 |
Date: Tue, 3 Mar 2020 14:51:42 +0000
|
|
|
22c213 |
Subject: [PATCH 10/18] migration/multifd: fix nullptr access in
|
|
|
22c213 |
multifd_send_terminate_threads
|
|
|
22c213 |
|
|
|
22c213 |
RH-Author: Juan Quintela <quintela@redhat.com>
|
|
|
22c213 |
Message-id: <20200303145143.149290-10-quintela@redhat.com>
|
|
|
22c213 |
Patchwork-id: 94117
|
|
|
22c213 |
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 09/10] migration/multifd: fix nullptr access in multifd_send_terminate_threads
|
|
|
22c213 |
Bugzilla: 1738451
|
|
|
22c213 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
22c213 |
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
|
22c213 |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
22c213 |
|
|
|
22c213 |
From: Zhimin Feng <fengzhimin1@huawei.com>
|
|
|
22c213 |
|
|
|
22c213 |
If the multifd_send_threads is not created when migration is failed,
|
|
|
22c213 |
multifd_save_cleanup would be called twice. In this senario, the
|
|
|
22c213 |
multifd_send_state is accessed after it has been released, the result
|
|
|
22c213 |
is that the source VM is crashing down.
|
|
|
22c213 |
|
|
|
22c213 |
Here is the coredump stack:
|
|
|
22c213 |
Program received signal SIGSEGV, Segmentation fault.
|
|
|
22c213 |
0x00005629333a78ef in multifd_send_terminate_threads (err=err@entry=0x0) at migration/ram.c:1012
|
|
|
22c213 |
1012 MultiFDSendParams *p = &multifd_send_state->params[i];
|
|
|
22c213 |
#0 0x00005629333a78ef in multifd_send_terminate_threads (err=err@entry=0x0) at migration/ram.c:1012
|
|
|
22c213 |
#1 0x00005629333ab8a9 in multifd_save_cleanup () at migration/ram.c:1028
|
|
|
22c213 |
#2 0x00005629333abaea in multifd_new_send_channel_async (task=0x562935450e70, opaque=<optimized out>) at migration/ram.c:1202
|
|
|
22c213 |
#3 0x000056293373a562 in qio_task_complete (task=task@entry=0x562935450e70) at io/task.c:196
|
|
|
22c213 |
#4 0x000056293373a6e0 in qio_task_thread_result (opaque=0x562935450e70) at io/task.c:111
|
|
|
22c213 |
#5 0x00007f475d4d75a7 in g_idle_dispatch () from /usr/lib64/libglib-2.0.so.0
|
|
|
22c213 |
#6 0x00007f475d4da9a9 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
|
|
|
22c213 |
#7 0x0000562933785b33 in glib_pollfds_poll () at util/main-loop.c:219
|
|
|
22c213 |
#8 os_host_main_loop_wait (timeout=<optimized out>) at util/main-loop.c:242
|
|
|
22c213 |
#9 main_loop_wait (nonblocking=nonblocking@entry=0) at util/main-loop.c:518
|
|
|
22c213 |
#10 0x00005629334c5acf in main_loop () at vl.c:1810
|
|
|
22c213 |
#11 0x000056293334d7bb in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4471
|
|
|
22c213 |
|
|
|
22c213 |
If the multifd_send_threads is not created when migration is failed.
|
|
|
22c213 |
In this senario, we don't call multifd_save_cleanup in multifd_new_send_channel_async.
|
|
|
22c213 |
|
|
|
22c213 |
Signed-off-by: Zhimin Feng <fengzhimin1@huawei.com>
|
|
|
22c213 |
Reviewed-by: Juan Quintela <quintela@redhat.com>
|
|
|
22c213 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
22c213 |
(cherry picked from commit 9c4d333c092e9c26d38f740ff3616deb42f21681)
|
|
|
22c213 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
22c213 |
---
|
|
|
22c213 |
migration/ram.c | 10 +++++++++-
|
|
|
22c213 |
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
22c213 |
|
|
|
22c213 |
diff --git a/migration/ram.c b/migration/ram.c
|
|
|
22c213 |
index 902c56c..3891eff 100644
|
|
|
22c213 |
--- a/migration/ram.c
|
|
|
22c213 |
+++ b/migration/ram.c
|
|
|
22c213 |
@@ -1229,7 +1229,15 @@ static void multifd_new_send_channel_async(QIOTask *task, gpointer opaque)
|
|
|
22c213 |
trace_multifd_new_send_channel_async(p->id);
|
|
|
22c213 |
if (qio_task_propagate_error(task, &local_err)) {
|
|
|
22c213 |
migrate_set_error(migrate_get_current(), local_err);
|
|
|
22c213 |
- multifd_save_cleanup();
|
|
|
22c213 |
+ /* Error happen, we need to tell who pay attention to me */
|
|
|
22c213 |
+ qemu_sem_post(&multifd_send_state->channels_ready);
|
|
|
22c213 |
+ qemu_sem_post(&p->sem_sync);
|
|
|
22c213 |
+ /*
|
|
|
22c213 |
+ * Although multifd_send_thread is not created, but main migration
|
|
|
22c213 |
+ * thread neet to judge whether it is running, so we need to mark
|
|
|
22c213 |
+ * its status.
|
|
|
22c213 |
+ */
|
|
|
22c213 |
+ p->quit = true;
|
|
|
22c213 |
} else {
|
|
|
22c213 |
p->c = QIO_CHANNEL(sioc);
|
|
|
22c213 |
qio_channel_set_delay(p->c, false);
|
|
|
22c213 |
--
|
|
|
22c213 |
1.8.3.1
|
|
|
22c213 |
|