[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/30] migration: Export tls-[creds|hostname|authz] params to cmdl
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 17/30] migration: Export tls-[creds|hostname|authz] params to cmdline too |
Date: |
Wed, 20 Jul 2022 12:19:13 +0100 |
From: Peter Xu <peterx@redhat.com>
It's useful for specifying tls credentials all in the cmdline (along with
the -object tls-creds-*), especially for debugging purpose.
The trick here is we must remember to not free these fields again in the
finalize() function of migration object, otherwise it'll cause double-free.
The thing is when destroying an object, we'll first destroy the properties
that bound to the object, then the object itself. To be explicit, when
destroy the object in object_finalize() we have such sequence of
operations:
object_property_del_all(obj);
object_deinit(obj, ti);
So after this change the two fields are properly released already even
before reaching the finalize() function but in object_property_del_all(),
hence we don't need to free them anymore in finalize() or it's double-free.
This also fixes a trivial memory leak for tls-authz as we forgot to free it
before this patch.
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20220707185515.27475-1-peterx@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/migration.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index cc41787079..7c7e529ca7 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -4366,6 +4366,9 @@ static Property migration_properties[] = {
DEFAULT_MIGRATE_ANNOUNCE_STEP),
DEFINE_PROP_BOOL("x-postcopy-preempt-break-huge", MigrationState,
postcopy_preempt_break_huge, true),
+ DEFINE_PROP_STRING("tls-creds", MigrationState, parameters.tls_creds),
+ DEFINE_PROP_STRING("tls-hostname", MigrationState,
parameters.tls_hostname),
+ DEFINE_PROP_STRING("tls-authz", MigrationState, parameters.tls_authz),
/* Migration capabilities */
DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE),
@@ -4403,12 +4406,9 @@ static void migration_class_init(ObjectClass *klass,
void *data)
static void migration_instance_finalize(Object *obj)
{
MigrationState *ms = MIGRATION_OBJ(obj);
- MigrationParameters *params = &ms->parameters;
qemu_mutex_destroy(&ms->error_mutex);
qemu_mutex_destroy(&ms->qemu_file_lock);
- g_free(params->tls_hostname);
- g_free(params->tls_creds);
qemu_sem_destroy(&ms->wait_unplug_sem);
qemu_sem_destroy(&ms->rate_limit_sem);
qemu_sem_destroy(&ms->pause_sem);
--
2.36.1
- [PULL 14/30] migration: Create the postcopy preempt channel asynchronously, (continued)
- [PULL 14/30] migration: Create the postcopy preempt channel asynchronously, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 11/30] migration: Postcopy preemption preparation on channel creation, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 16/30] migration: Add helpers to detect TLS capability, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 15/30] migration: Add property x-postcopy-preempt-break-huge, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 19/30] migration: Respect postcopy request order in preemption mode, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 22/30] tests: Add postcopy tls recovery migration test, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 18/30] migration: Enable TLS for preempt channel, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 09/30] multifd: Copy pages before compressing them with zlib, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 20/30] tests: Move MigrateCommon upper, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 24/30] migration: remove unreachable code after reading data, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 17/30] migration: Export tls-[creds|hostname|authz] params to cmdline too,
Dr. David Alan Gilbert (git) <=
- [PULL 26/30] Add dirty-sync-missed-zero-copy migration stat, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 21/30] tests: Add postcopy tls migration test, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 23/30] tests: Add postcopy preempt tests, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 30/30] Revert "gitlab: disable accelerated zlib for s390x", Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 27/30] migration/multifd: Report to user when zerocopy not working, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 28/30] multifd: Document the locking of MultiFD{Send/Recv}Params, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 25/30] QIOChannelSocket: Fix zero-copy flush returning code 1 when nothing sent, Dr. David Alan Gilbert (git), 2022/07/20
- [PULL 29/30] migration: Avoid false-positive on non-supported scenarios for zero-copy-send, Dr. David Alan Gilbert (git), 2022/07/20
- Re: [PULL 00/30] migration queue, Peter Maydell, 2022/07/21