[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 08/33] migration/multifd: Allow premature EOF on TLS incoming
From: |
Maciej S. Szmigiero |
Subject: |
[PATCH v4 08/33] migration/multifd: Allow premature EOF on TLS incoming channels |
Date: |
Thu, 30 Jan 2025 11:08:29 +0100 |
From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
Multifd send channels are terminated by calling
qio_channel_shutdown(QIO_CHANNEL_SHUTDOWN_BOTH) in
multifd_send_terminate_threads(), which in the TLS case essentially
calls shutdown(SHUT_RDWR) on the underlying raw socket.
Unfortunately, this does not terminate the TLS session properly and
the receive side sees this as a GNUTLS_E_PREMATURE_TERMINATION error.
The only reason why this wasn't causing migration failures is because
the current migration code apparently does not check for migration
error being set after the end of the multifd receive process.
However, this will change soon so the multifd receive code has to be
prepared to not return an error on such premature TLS session EOF.
Use the newly introduced QIOChannelTLS method for that.
It's worth noting that even if the sender were to be changed to terminate
the TLS connection properly the receive side still needs to remain
compatible with older QEMU bit stream which does not do this.
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
---
migration/multifd.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/migration/multifd.c b/migration/multifd.c
index ab73d6d984cf..ceaad930e141 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -1310,6 +1310,7 @@ void multifd_recv_new_channel(QIOChannel *ioc, Error
**errp)
Error *local_err = NULL;
bool use_packets = multifd_use_packets();
int id;
+ QIOChannelTLS *ioc_tls;
if (use_packets) {
id = multifd_recv_initial_packet(ioc, &local_err);
@@ -1337,6 +1338,13 @@ void multifd_recv_new_channel(QIOChannel *ioc, Error
**errp)
p->c = ioc;
object_ref(OBJECT(ioc));
+ ioc_tls = QIO_CHANNEL_TLS(object_dynamic_cast(OBJECT(ioc),
+ TYPE_QIO_CHANNEL_TLS));
+ if (ioc_tls) {
+ /* Multifd send channels do not terminate the TLS session properly */
+ qio_channel_tls_set_premature_eof_okay(ioc_tls, true);
+ }
+
p->thread_created = true;
qemu_thread_create(&p->thread, p->name, multifd_recv_thread, p,
QEMU_THREAD_JOINABLE);
- [PATCH v4 00/33] Multifd 🔀 device state transfer support with VFIO consumer, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 01/33] migration: Clarify that {load, save}_cleanup handlers can run without setup, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 03/33] thread-pool: Rename AIO pool functions to *_aio() and data types to *Aio, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 02/33] thread-pool: Remove thread_pool_submit() function, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 04/33] thread-pool: Implement generic (non-AIO) pool support, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 05/33] migration: Add MIG_CMD_SWITCHOVER_START and its load handler, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 06/33] migration: Add qemu_loadvm_load_state_buffer() and its handler, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 07/33] io: tls: Allow terminating the TLS session gracefully with EOF, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 08/33] migration/multifd: Allow premature EOF on TLS incoming channels,
Maciej S. Szmigiero <=
- [PATCH v4 09/33] migration: postcopy_ram_listen_thread() needs to take BQL for some calls, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 10/33] error: define g_autoptr() cleanup function for the Error type, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 11/33] migration: Add thread pool of optional load threads, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 12/33] migration/multifd: Split packet into header and RAM data, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 13/33] migration/multifd: Device state transfer support - receive side, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 14/33] migration/multifd: Make multifd_send() thread safe, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 15/33] migration/multifd: Add an explicit MultiFDSendData destructor, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 16/33] migration/multifd: Device state transfer support - send side, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 17/33] migration/multifd: Make MultiFDSendData a struct, Maciej S. Szmigiero, 2025/01/30
- [PATCH v4 18/33] migration/multifd: Add multifd_device_state_supported(), Maciej S. Szmigiero, 2025/01/30