From nobody Mon Apr 6 21:32:56 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1773771870; cv=none; d=zohomail.com; s=zohoarc; b=AO12vcyGlnMxBzUjG2Yi78aF8V6x4HetuWdMErRWbToAgU2CWa5ogDDGuAEG+VkAVM76n85ise5exCdcAPij9rXBtHaHykFgQZcVVBLZE12FTC9DuWKdepFRVZgEbWQzviUTgVFnVJ5Osq1exyRkRV+ajuOu/JzwoGnQiikzgNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773771870; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=b8qszfObvvrpBzl9FjAnV8XOcetgvioqDs1BJyFKlgo=; b=W/nZUk1FrTHTQThq5dpJ6kmScTmbDku/qvJinawzhHdDat9thf80N++mXTPgzC+lIGhV0obqhJbF4vNa/AIX3cculv3yJbWcoqIvuFce1UEqGwAIu09UboNT/VUg2GAjvPU1ME/skxG2r6IRQvxqRoPY8FtTBtSwiAPUi3ANE3o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177377187054522.793397343438073; Tue, 17 Mar 2026 11:24:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Z4m-0003l2-AP; Tue, 17 Mar 2026 14:23:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Z4k-0003ke-UG for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:23:30 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w2Z4j-00034A-2P for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:23:30 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5B4C54D3BC; Tue, 17 Mar 2026 18:23:25 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 35E234273B; Tue, 17 Mar 2026 18:23:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id oDxMOxucuWnXdQAAD6G6ig (envelope-from ); Tue, 17 Mar 2026 18:23:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771805; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b8qszfObvvrpBzl9FjAnV8XOcetgvioqDs1BJyFKlgo=; b=No8xyFZpYxwgiXrFKEQgLL6N65RpfAr9q54p8JsR5G/IuZaKRexDWjmuI4tXsM8imyg7pK MyonhFRTVMVFwzuaPSNSQZLWCd+Mi9RZFHf60bOTjbYkIF5fsDjr+vcq/2Ru7VC+z3CeWp 89WZlfBt5qCAVfi8G4/SAe3u4XDjRAA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771805; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b8qszfObvvrpBzl9FjAnV8XOcetgvioqDs1BJyFKlgo=; b=ADo2kutz1HHolpjBAWS/TaMccV4aM3VkIcaWVgPK/cyPDiu0pbh16nb9wy1ExObSPn4Ckl 02aTicUJZPruEuCQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=No8xyFZp; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=ADo2kutz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771805; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b8qszfObvvrpBzl9FjAnV8XOcetgvioqDs1BJyFKlgo=; b=No8xyFZpYxwgiXrFKEQgLL6N65RpfAr9q54p8JsR5G/IuZaKRexDWjmuI4tXsM8imyg7pK MyonhFRTVMVFwzuaPSNSQZLWCd+Mi9RZFHf60bOTjbYkIF5fsDjr+vcq/2Ru7VC+z3CeWp 89WZlfBt5qCAVfi8G4/SAe3u4XDjRAA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771805; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b8qszfObvvrpBzl9FjAnV8XOcetgvioqDs1BJyFKlgo=; b=ADo2kutz1HHolpjBAWS/TaMccV4aM3VkIcaWVgPK/cyPDiu0pbh16nb9wy1ExObSPn4Ckl 02aTicUJZPruEuCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 01/10] tests/qtest/migration: Fix leak of migration tests data Date: Tue, 17 Mar 2026 15:23:11 -0300 Message-ID: <20260317182320.31991-2-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317182320.31991-1-farosas@suse.de> References: <20260317182320.31991-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:mid,suse.de:dkim,suse.de:email]; ASN(0.00)[asn:32098, ipnet:2800::/6, country:US]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Spam-Score: -3.01 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 5B4C54D3BC Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1773771872232158500 Content-Type: text/plain; charset="utf-8" When the migration-test is invoked with the '-p' flag (to run a single test), the glib code won't call the destroy function for the not-executed tests, causing the MigrationTest wrapper data to leak. This doesn't affect make check, but affects debugging use-cases where having a leak pop up in ASAN output is extra annoying. Fix by adding the tests data to a list and freeing them all at the end of migration-test execution. Any tests actually dispatched by glib will have the destroy function called as usual. Note that migration_test_add_suffix() is altered to call migration_test_add() so that there's only one place adding the data to the list. Performance is not an issue at the moment, we have < 100 tests. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260311213418.16951-2-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- tests/qtest/migration/framework.c | 2 ++ tests/qtest/migration/migration-util.c | 19 ++++++++++++++----- tests/qtest/migration/migration-util.h | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 0bfc241914..b9371372de 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -1162,5 +1162,7 @@ int migration_env_clean(MigrationTestEnv *env) } g_free(tmpfs); =20 + migration_tests_free(); + return ret; } diff --git a/tests/qtest/migration/migration-util.c b/tests/qtest/migration= /migration-util.c index c2462306a1..2648ad7f61 100644 --- a/tests/qtest/migration/migration-util.c +++ b/tests/qtest/migration/migration-util.c @@ -38,6 +38,7 @@ #include "linux/kvm.h" #endif =20 +GQueue *tests; =20 static char *SocketAddress_to_str(SocketAddress *addr) { @@ -243,6 +244,8 @@ static void migration_test_destroy(gpointer data) { MigrationTest *test =3D (MigrationTest *)data; =20 + g_queue_remove(tests, test); + g_free(test->data); g_free(test->name); g_free(test); @@ -268,21 +271,27 @@ void migration_test_add(const char *path, =20 qtest_add_data_func_full(path, test, migration_test_wrapper, migration_test_destroy); + if (!tests) { + tests =3D g_queue_new(); + } + g_queue_push_tail(tests, test); } =20 void migration_test_add_suffix(const char *path, const char *suffix, void (*fn)(char *name, MigrateCommon *args)) { - MigrationTest *test =3D g_new0(MigrationTest, 1); + g_autofree char *name =3D NULL; =20 g_assert(g_str_has_suffix(path, "/")); g_assert(!g_str_has_prefix(suffix, "/")); =20 - test->func =3D fn; - test->name =3D g_strconcat(path, suffix, NULL); + name =3D g_strconcat(path, suffix, NULL); + migration_test_add(name, fn); +} =20 - qtest_add_data_func_full(test->name, test, migration_test_wrapper, - migration_test_destroy); +void migration_tests_free(void) +{ + g_queue_free_full(tests, migration_test_destroy); } =20 #ifdef O_DIRECT diff --git a/tests/qtest/migration/migration-util.h b/tests/qtest/migration= /migration-util.h index e73d69bab0..694773e594 100644 --- a/tests/qtest/migration/migration-util.h +++ b/tests/qtest/migration/migration-util.h @@ -59,5 +59,5 @@ void migration_test_add_suffix(const char *path, const ch= ar *suffix, void (*fn)(char *name, MigrateCommon *args)= ); char *migrate_get_connect_uri(QTestState *who); void migrate_set_ports(QTestState *to, QList *channel_list); - +void migration_tests_free(void); #endif /* MIGRATION_UTIL_H */ --=20 2.51.0 From nobody Mon Apr 6 21:32:56 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1773771829; cv=none; d=zohomail.com; s=zohoarc; b=EqkQNzdOZHcNA85wypZNLvhhnvyWBpvZZGSLGXbTkVv2JSu5MiB+zSsSLMSJ0KM+cAfvwv4wG4kW0xe6hYBf5aobJVxbbf1kllqFkUMJZQtwHDheBq7LmAyivmkPahGjkIXlEa8UngGhMI7YcieW25AAedvwAAYm6iOzXhm5wvI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773771829; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=p+dTExZBMHFzkLkb8N9Pg48ajqt86T+5PfNBNdyoA7k=; b=MKSidECByzznK06XCZcoDtj0AIi6M74FgUpCmOJUpQd7i8Mq6mYbedFqIBpAko2pn8LnbWPcnxhcpxKUGWun0fbW+Yc3yg15Dw+RFAx4SxmVEnTnh0MceeVfDDD9Hcd51oJOfFJlEF9+r2ZkMBCYChs50f9Qgi+Eatee6gC2VQg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773771829051832.2758724634724; Tue, 17 Mar 2026 11:23:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Z4t-0003mk-M0; Tue, 17 Mar 2026 14:23:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Z4r-0003lo-2o for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:23:37 -0400 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w2Z4o-00034e-Tl for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:23:36 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id EAE2F4D3AD; Tue, 17 Mar 2026 18:23:26 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C5D244273B; Tue, 17 Mar 2026 18:23:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id gOnNIh2cuWnXdQAAD6G6ig (envelope-from ); Tue, 17 Mar 2026 18:23:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771807; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p+dTExZBMHFzkLkb8N9Pg48ajqt86T+5PfNBNdyoA7k=; b=l8rG3FqkqoMOQO5ZFynFZjpeNqXDKZ8QJTRJZJoOTYlQjY1eqzVzH8sdcsG/rGXTMA+L1z s2AQdwA6sEj/LApghkD7OBuMDd4OzpPlv7df3EzTjGE+lbvxwxJ1/rYUAY/Wu4YXxxYPsP gHIAQrFsYu8+47iLtudcupUCn3zIHwk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771807; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p+dTExZBMHFzkLkb8N9Pg48ajqt86T+5PfNBNdyoA7k=; b=q4grBtcTAU93qquoOvN/sIq4yQZiVcfkntnMHJkZEnnT8ebnaVia4fSDkdv8rJLERMUij3 NhfuMdboE+gp/5CQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=1MXxdPfw; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=g+oCcvZS DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771806; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p+dTExZBMHFzkLkb8N9Pg48ajqt86T+5PfNBNdyoA7k=; b=1MXxdPfwE9Yt7+KI2wUvAjay0oLrZ4kQ9IVu7KLBmqP1vLexz/CKiBk2ygP4Aji6MIczHB 5bVw1ZvYJhk420nafOalWq854MVxlY2hjoit5q4vwFDfrhujPfV8pqfySKjPI5DFx7Si1p ol5pa5Nfr7brBe+ZLzO/2xK1m+NnajE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771806; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p+dTExZBMHFzkLkb8N9Pg48ajqt86T+5PfNBNdyoA7k=; b=g+oCcvZSqfTHaWhQxDGSNsfroJDlmdEEzFxK/VLm25H0ATZnnDJ4Meuk7VCoujROb9H3pR B9YEP4tTo7zAdsCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PULL 02/10] io: Fix TLS bye task leak Date: Tue, 17 Mar 2026 15:23:12 -0300 Message-ID: <20260317182320.31991-3-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317182320.31991-1-farosas@suse.de> References: <20260317182320.31991-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.51 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ASN(0.00)[asn:32098, ipnet:2800::/6, country:US]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Spam-Score: -3.51 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: EAE2F4D3AD Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) (identity @suse.de) X-ZM-MESSAGEID: 1773771830078158500 Recent fixes to TLS tasks memory handling have left the TLS bye task uncovered. Fix by freeing the task in the same way the handshake task is freed. Direct leak of 704 byte(s) in 4 object(s) allocated from: #1 0x7f5909b1d6a0 in g_malloc0 ../glib/gmem.c:163 #2 0x557650496d61 in qio_task_new ../io/task.c:58:12 #3 0x557650475d7f in qio_channel_tls_bye ../io/channel-tls.c:352:12 #4 0x55764f7a1bb4 in migration_tls_channel_end ../migration/tls.c:159:5 #5 0x55764f709750 in migration_ioc_shutdown_gracefully ../migration/mul= tifd.c:462:9 #6 0x55764f6fcf53 in multifd_send_terminate_threads ../migration/multif= d.c:493:13 #7 0x55764f6fcafb in multifd_send_shutdown ../migration/multifd.c:580:5 #8 0x55764f6e1b14 in migration_cleanup ../migration/migration.c:1323:9 #9 0x55764f6f5bac in migration_cleanup_bh ../migration/migration.c:1350= :5 Fixes: d39d0f3acd ("io: fix cleanup for TLS I/O source data on cancellation= ") Reviewed-by: Daniel P. Berrang=C3=A9 Acked-by: Daniel P. Berrang=C3=A9 Link: https://lore.kernel.org/qemu-devel/20260311213418.16951-3-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- io/channel-tls.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/io/channel-tls.c b/io/channel-tls.c index 940fc3c6d1..31ec4d236d 100644 --- a/io/channel-tls.c +++ b/io/channel-tls.c @@ -352,7 +352,9 @@ void qio_channel_tls_bye(QIOChannelTLS *ioc, Error **er= rp) task =3D qio_task_new(OBJECT(ioc), propagate_error, errp, NULL); =20 trace_qio_channel_tls_bye_start(ioc); - qio_channel_tls_bye_task(ioc, task, NULL); + if (qio_channel_tls_bye_task(ioc, task, NULL)) { + qio_task_free(task); + } } =20 static void qio_channel_tls_init(Object *obj G_GNUC_UNUSED) --=20 2.51.0 From nobody Mon Apr 6 21:32:56 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1773771858; cv=none; d=zohomail.com; s=zohoarc; b=GamZBjDIQxLzTdgd85YYJ7nXqpT++KFr+oOclVOAeBk9xUqWC8DLPE2FJ99jrqOHSPkjtTPCZXKS+K8rOHApLwqVVJPb8XhGC7CmkyYMSiI8rurwU/5xBiVsW5csEBGpnMirur5Ka4HIG99EWeFoBnahZSCijnDrDeNSrBVKCZU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773771858; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mc6OQGr9KDCwK2JPTsR63nsrSMYSrNNoCmK5GBWbLyc=; b=B+GxG+I8n+n5XE+xS4KeyvYpAVxMjNLNN+okrmhDBdbZPDL7C+hb8U0D9K2fiMRtdZhIhq2L0WyNzghc/PrB4OU3OTVJ66Wan3u0ZmPZOUBO1AwUf/EinXLmrUeLALhRpvp/k7kCJE61TpBvMm06DyHIvr4GOlcNRHt+L/x7hsA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773771858791410.1080664774107; Tue, 17 Mar 2026 11:24:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Z52-0003tb-DF; Tue, 17 Mar 2026 14:23:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Z4x-0003nh-Bw for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:23:43 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w2Z4u-00035E-IC for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:23:42 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 878564D3BD; Tue, 17 Mar 2026 18:23:28 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 625ED4273B; Tue, 17 Mar 2026 18:23:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id +FF5Ch+cuWnXdQAAD6G6ig (envelope-from ); Tue, 17 Mar 2026 18:23:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771808; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mc6OQGr9KDCwK2JPTsR63nsrSMYSrNNoCmK5GBWbLyc=; b=DISzavzuNkrIIwy6Pfmjmmbn1a5iNQOFGPimXjKVytjcw4ArIBf0N5iARuFaXtjflbfbyI tswBapgNOAPGCyw+ITyvkiaIP2d8MDPBf+1wERJVN66F9HfrsqiWXLBvIH+vx+REw4Y+TM 5nbwDUTCn/PW7O2GGFSHwF2jaBYFVaU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771808; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mc6OQGr9KDCwK2JPTsR63nsrSMYSrNNoCmK5GBWbLyc=; b=duP4ySXLpqUqTstf9r14ITTNiQCFD/sOD4e4tHBE8OPity87iOFzDUTQtj4LDY918gxEwf ueiJYlFybpJb2eCw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771808; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mc6OQGr9KDCwK2JPTsR63nsrSMYSrNNoCmK5GBWbLyc=; b=DISzavzuNkrIIwy6Pfmjmmbn1a5iNQOFGPimXjKVytjcw4ArIBf0N5iARuFaXtjflbfbyI tswBapgNOAPGCyw+ITyvkiaIP2d8MDPBf+1wERJVN66F9HfrsqiWXLBvIH+vx+REw4Y+TM 5nbwDUTCn/PW7O2GGFSHwF2jaBYFVaU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771808; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mc6OQGr9KDCwK2JPTsR63nsrSMYSrNNoCmK5GBWbLyc=; b=duP4ySXLpqUqTstf9r14ITTNiQCFD/sOD4e4tHBE8OPity87iOFzDUTQtj4LDY918gxEwf ueiJYlFybpJb2eCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 03/10] tests/qtest/migration: Fix leak in CPR exec test Date: Tue, 17 Mar 2026 15:23:13 -0300 Message-ID: <20260317182320.31991-4-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317182320.31991-1-farosas@suse.de> References: <20260317182320.31991-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1773771860513158500 Content-Type: text/plain; charset="utf-8" The string was being dup'ed only to get around the const of the qdict_get_str() return value. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260311213418.16951-4-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- tests/qtest/migration/cpr-tests.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-= tests.c index 0d97b5b89f..63ca5f3996 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -154,15 +154,16 @@ static void set_cpr_exec_args(QTestState *who, Migrat= eCommon *args) static void wait_for_migration_event(QTestState *who, const char *waitfor) { QDict *rsp, *data; - char *status; bool done =3D false; =20 while (!done) { + const char *status; + rsp =3D qtest_qmp_eventwait_ref(who, "MIGRATION"); g_assert(qdict_haskey(rsp, "data")); data =3D qdict_get_qdict(rsp, "data"); g_assert(qdict_haskey(data, "status")); - status =3D g_strdup(qdict_get_str(data, "status")); + status =3D qdict_get_str(data, "status"); g_assert(strcmp(status, "failed")); done =3D !strcmp(status, waitfor); qobject_unref(rsp); --=20 2.51.0 From nobody Mon Apr 6 21:32:56 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1773771838; cv=none; d=zohomail.com; s=zohoarc; b=eiF879cwlcrPMxdH9+FGaV0myxAdCm0mMW1IYGkFIFub0fyUnf6APFVIcZKw5TXoGw/xHw2sCqX3jRwNLkiSHZhIyxWE57B43eOsVyPrr++uyOeOjdPI7jmi29vGBnxYNSMtY2n+/QQq5H5XfM2L66jAZBtqZY6m2+2ZOSdKUOU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773771838; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lssqIUf9TDxBTExNNOE76ZmyHuhCOxsdXOC6b5j4Axo=; b=Xp8dSfhzpVDPaOLlW+bMCkW13djACtGvWMPbARBiG/HX+qUbk8VgmizBWmh5PpWSZ2yVm6dd9V2iZ+pRyxkUtac9FqgDcqA3zzymi8k4+aAbkiug3yix72ZZtCgVzJUBblblSqU2Qf2TN0as03Gyj0ra+NxnZQMZD547k3a3+BA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177377183894748.65000354735889; Tue, 17 Mar 2026 11:23:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Z59-0003yP-2Q; Tue, 17 Mar 2026 14:23:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Z54-0003wL-8C for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:23:52 -0400 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w2Z51-00035i-Hg for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:23:48 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 23F554D3BF; Tue, 17 Mar 2026 18:23:30 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id F31834273B; Tue, 17 Mar 2026 18:23:28 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id wJrHLSCcuWnXdQAAD6G6ig (envelope-from ); Tue, 17 Mar 2026 18:23:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771810; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lssqIUf9TDxBTExNNOE76ZmyHuhCOxsdXOC6b5j4Axo=; b=Z0+FK3CKOxyYDTmXe4L9KI4j9hGnQRmgngBSKbpI7/flBvfHHeiSvKhCeFH9Xg9ghIi3Kv Zv3kAT1DF4NRvquuGQ+liVzgEA5Z6CyDEP9qXe2kvweiNNKtLH68FYPHMQMCEIMV7DfDdS Ww1GEm9gdxdKtPnpv0EwiWV7zpRPcrg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771810; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lssqIUf9TDxBTExNNOE76ZmyHuhCOxsdXOC6b5j4Axo=; b=g3fR9Orne/UoGlTIuQ5owEj3lIQmtMZz2jR7i9JgRgcygnaqaE4qFNSdtrav1EV4lWHPOX HE+JjrzqHHRBEZDA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Z0+FK3CK; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=g3fR9Orn DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771810; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lssqIUf9TDxBTExNNOE76ZmyHuhCOxsdXOC6b5j4Axo=; b=Z0+FK3CKOxyYDTmXe4L9KI4j9hGnQRmgngBSKbpI7/flBvfHHeiSvKhCeFH9Xg9ghIi3Kv Zv3kAT1DF4NRvquuGQ+liVzgEA5Z6CyDEP9qXe2kvweiNNKtLH68FYPHMQMCEIMV7DfDdS Ww1GEm9gdxdKtPnpv0EwiWV7zpRPcrg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771810; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lssqIUf9TDxBTExNNOE76ZmyHuhCOxsdXOC6b5j4Axo=; b=g3fR9Orne/UoGlTIuQ5owEj3lIQmtMZz2jR7i9JgRgcygnaqaE4qFNSdtrav1EV4lWHPOX HE+JjrzqHHRBEZDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 04/10] migration/multifd: Fix leaks of TLS error objects Date: Tue, 17 Mar 2026 15:23:14 -0300 Message-ID: <20260317182320.31991-5-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317182320.31991-1-farosas@suse.de> References: <20260317182320.31991-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; ASN(0.00)[asn:32098, ipnet:2800::/6, country:US]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Spam-Score: -3.01 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 23F554D3BF Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1773771840824154100 Content-Type: text/plain; charset="utf-8" The code currently ignores errors from multifd threads that happen after a first error has already been propagated. Make sure the subsequent errors are freed appopriately. This fixes a leak of the TLS session->werr when the certificate validation fails after multifd threads are already running. The first writes on the threads will fail deep into the gnutls stack. No need to check if(err) because the callers are all under a similar check. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260311213418.16951-5-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- migration/multifd.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index 8b9ed84805..035cb70f7b 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -412,28 +412,25 @@ bool multifd_send(MultiFDSendData **send_data) /* Multifd send side hit an error; remember it and prepare to quit */ static void multifd_send_error_propagate(Error *err) { + MigrationState *s =3D migrate_get_current(); + /* - * We don't want to exit each threads twice. Depending on where - * we get the error, or if there are two independent errors in two - * threads at the same time, we can end calling this function - * twice. + * There may be independent errors in each thread. Propagate the + * first and free the subsequent ones. */ if (qatomic_xchg(&multifd_send_state->exiting, 1)) { + error_free(err); return; } =20 - if (err) { - MigrationState *s =3D migrate_get_current(); + migrate_error_propagate(s, err); =20 - migrate_error_propagate(s, err); - - if (s->state =3D=3D MIGRATION_STATUS_SETUP || - s->state =3D=3D MIGRATION_STATUS_PRE_SWITCHOVER || - s->state =3D=3D MIGRATION_STATUS_DEVICE || - s->state =3D=3D MIGRATION_STATUS_ACTIVE) { - migrate_set_state(&s->state, s->state, - MIGRATION_STATUS_FAILING); - } + if (s->state =3D=3D MIGRATION_STATUS_SETUP || + s->state =3D=3D MIGRATION_STATUS_PRE_SWITCHOVER || + s->state =3D=3D MIGRATION_STATUS_DEVICE || + s->state =3D=3D MIGRATION_STATUS_ACTIVE) { + migrate_set_state(&s->state, s->state, + MIGRATION_STATUS_FAILING); } } =20 --=20 2.51.0 From nobody Mon Apr 6 21:32:56 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1773771884; cv=none; d=zohomail.com; s=zohoarc; b=T5sRxZ9gcVklZA3uGwDvh/Jl36IY0QR5Id/YE7yNbGhx3MX1NasSRnFhY6XTNxStQDoMqnoKCf4ACEMI62Ad13rx63u1EY3gfony14N1tZ3mbF8+ydwv+7gnrVsl4aeJNgv3GYz1Ilgf3NK6YVEsK1QdBX7L25q49POZD1PLOiA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773771884; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aHIrAt1C4Urd261FqBqZNkoI7um30J57gWKdglKuMD0=; b=bvZnmUbVkSJ4lJtUKQPa3/ujA+zCwJJ/vt7kVvEG0gNw1RMJkV/fnISec0aExgMdbsUrT0CYghjPnOgJSkkLoeFoTYX9Rv3dOsnUcWWedwpbrzM9swWbItCoBgz1FebRCynE92PDfKZbvKR30gx8/lVFD4o1vYYIFVvKNJMZXWE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773771884485518.5620556795202; Tue, 17 Mar 2026 11:24:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Z5E-0004Hz-He; Tue, 17 Mar 2026 14:24:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Z5B-00049c-Rl for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:23:57 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w2Z58-00036c-TM for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:23:57 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B64B84D3AE; Tue, 17 Mar 2026 18:23:31 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8FC134273B; Tue, 17 Mar 2026 18:23:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id oPaUFSKcuWnXdQAAD6G6ig (envelope-from ); Tue, 17 Mar 2026 18:23:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771811; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aHIrAt1C4Urd261FqBqZNkoI7um30J57gWKdglKuMD0=; b=oxfgX+L6SIoWxCB1TvhN1T+5TK5z2U7M6fKtXz62KeoaKzxDuT2qLLmk4OSMGRcWmK1CPS 08zodyt/lGXy0nFHTr1duGzQgyc4U2oOx0w4w3c47aqlJg5JNbEZMChnOxs0HeLNFMj2Lc +GFYfZZ7yMRWHb+FBEBU5cS/FbyIoNc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771811; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aHIrAt1C4Urd261FqBqZNkoI7um30J57gWKdglKuMD0=; b=UptZSe1Q1hnmCO3loi9ebWorMFWf25iu3k8hDoVPpu+VUf7wRLRpGxL1Svo1yqOYcFrwSh m0XIc3a+eBD4btCw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771811; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aHIrAt1C4Urd261FqBqZNkoI7um30J57gWKdglKuMD0=; b=oxfgX+L6SIoWxCB1TvhN1T+5TK5z2U7M6fKtXz62KeoaKzxDuT2qLLmk4OSMGRcWmK1CPS 08zodyt/lGXy0nFHTr1duGzQgyc4U2oOx0w4w3c47aqlJg5JNbEZMChnOxs0HeLNFMj2Lc +GFYfZZ7yMRWHb+FBEBU5cS/FbyIoNc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771811; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aHIrAt1C4Urd261FqBqZNkoI7um30J57gWKdglKuMD0=; b=UptZSe1Q1hnmCO3loi9ebWorMFWf25iu3k8hDoVPpu+VUf7wRLRpGxL1Svo1yqOYcFrwSh m0XIc3a+eBD4btCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 05/10] tests/qtest/migration: Force exit-on-error=false Date: Tue, 17 Mar 2026 15:23:15 -0300 Message-ID: <20260317182320.31991-6-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317182320.31991-1-farosas@suse.de> References: <20260317182320.31991-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_THREE(0.00)[3]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1773771887328154100 Content-Type: text/plain; charset="utf-8" Some tests can cause QEMU to exit(1) too early while the incoming coroutine has not yielded for a first time yet. This trips ASAN because resources related to dispatching the incoming process will still be allocated in the io/channel.c layer without a straight-forward way for the migration code to clean them up. As an example of one such issue, the UUID validation happens early enough that the temporary socket from qio_net_listener_channel_func() still has an elevated refcount. If it fails, the listener dispatch code never gets to free the resource: 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:4= 01: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:4= 284 #10 0x7f3c7e2b00c8 in g_main_context_dispatch ../glib/gmain.c:4272 The exit(1) also requires some tests to setup qtest to expect a return code of 1 from the QEMU process. Although we can check migration status changes to be fairly certain where the failure happened, there is always the possibility of QEMU exiting for another reason and the test passing. This happens frequently with sanitizers enabled, but also risks masking issues in the regular build. Stop allowing the incoming migration to exit and instead require the tests to wait for the FAILED state and end QEMU gracefully with qtest_quit. In practice this means setting exit-on-error=3Dfalse for every incoming migration, changing MIG_TEST_FAIL_DEST_QUIT_ERR to MIG_TEST_FAIL and waiting for a change of state where necessary. With this, the MIG_TEST_FAIL_DEST_QUIT_ERR error result is now unused, remove it. The affected tests are: validate_uuid_error multifd_tcp_cancel dirty_limit precopy_unix_tls_x509_default_host precopy_tcp_tls_no_hostname tcp_tls_x509_mismatch_host dbus_vmstate_missing_src dbus_vmstate_missing_dst Also add a comment to QEMU source explaining that the incoming coroutine might block for a while until it yields as this is the actual root cause of the issue. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260311213418.16951-6-farosas@sus= e.de [assert that key doesn't already exists] Signed-off-by: Fabiano Rosas --- migration/migration.c | 5 +++++ tests/qtest/dbus-vmstate-test.c | 5 +++-- tests/qtest/migration/framework.c | 5 +---- tests/qtest/migration/framework.h | 2 -- tests/qtest/migration/migration-qmp.c | 7 +++++++ tests/qtest/migration/misc-tests.c | 4 ++-- tests/qtest/migration/precopy-tests.c | 12 +++++------- tests/qtest/migration/tls-tests.c | 14 ++++++++------ 8 files changed, 31 insertions(+), 23 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) =20 Coroutine *co =3D 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(). + */ } =20 int migrate_send_rp_switchover_ack(MigrationIncomingState *mis) diff --git a/tests/qtest/dbus-vmstate-test.c b/tests/qtest/dbus-vmstate-tes= t.c index 6c990864e3..0a82cc9f93 100644 --- a/tests/qtest/dbus-vmstate-test.c +++ b/tests/qtest/dbus-vmstate-test.c @@ -219,8 +219,8 @@ test_dbus_vmstate(Test *test) =20 dstaddr =3D g_strsplit(g_test_dbus_get_bus_address(dstbus), ",", 2); dst_qemu_args =3D - g_strdup_printf("-object dbus-vmstate,id=3Ddv,addr=3D%s -incoming = %s", - dstaddr[0], uri); + g_strdup_printf("-object dbus-vmstate,id=3Ddv,addr=3D%s -incoming = defer", + dstaddr[0]); =20 src_qemu =3D qtest_init(src_qemu_args); dst_qemu =3D qtest_init(dst_qemu_args); @@ -229,6 +229,7 @@ test_dbus_vmstate(Test *test) =20 thread =3D g_thread_new("dbus-vmstate-thread", dbus_vmstate_thread, lo= op); =20 + migrate_incoming_qmp(dst_qemu, uri, NULL, "{}"); migrate_qmp(src_qemu, uri, "{}"); test->src_qemu =3D src_qemu; if (test->migrate_fail) { diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index b9371372de..9f71d51f1e 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -576,6 +576,7 @@ static int migrate_postcopy_prepare(QTestState **from_p= tr, migrate_prepare_for_dirty_mem(from); qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," " 'arguments': { " + " 'exit-on-error': false," " 'channels': [ { 'channel-type': 'main'= ," " 'addr': { 'transport': 'socket'," " 'type': 'inet'," @@ -906,10 +907,6 @@ int test_precopy_common(MigrateCommon *args) if (args->result !=3D MIG_TEST_SUCCEED) { bool allow_active =3D args->result =3D=3D MIG_TEST_FAIL; wait_for_migration_fail(from, allow_active); - - if (args->result =3D=3D MIG_TEST_FAIL_DEST_QUIT_ERR) { - qtest_set_expected_status(to, EXIT_FAILURE); - } } else { if (args->live) { /* diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/fram= ework.h index 80eef75893..79604c60f5 100644 --- a/tests/qtest/migration/framework.h +++ b/tests/qtest/migration/framework.h @@ -208,8 +208,6 @@ typedef struct { MIG_TEST_SUCCEED =3D 0, /* This test should fail, dest qemu should keep alive */ MIG_TEST_FAIL, - /* This test should fail, dest qemu should fail with abnormal stat= us */ - MIG_TEST_FAIL_DEST_QUIT_ERR, /* The QMP command for this migration should fail with an error */ MIG_TEST_QMP_ERROR, } result; diff --git a/tests/qtest/migration/migration-qmp.c b/tests/qtest/migration/= migration-qmp.c index 8279504db1..437b5eaeff 100644 --- a/tests/qtest/migration/migration-qmp.c +++ b/tests/qtest/migration/migration-qmp.c @@ -173,6 +173,13 @@ void migrate_incoming_qmp(QTestState *to, const char *= uri, QObject *channels, /* This function relies on the event to work, make sure it's enabled */ migrate_set_capability(to, "events", true); =20 + /* + * Set the incoming migration to never exit QEMU abruptly during + * the tests. It causes issues when running sanitizers and + * expecting a failure exit code can mask other issues. + */ + g_assert(!qdict_haskey(args, "exit-on-error")); + qdict_put_bool(args, "exit-on-error", false); rsp =3D qtest_qmp(to, "{ 'execute': 'migrate-incoming', 'arguments': %= p}", args); =20 diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/mis= c-tests.c index 810e9e6549..196f1ca842 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, b= ool should_fail) g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; =20 - if (migrate_start(&from, &to, uri, args)) { + if (migrate_start(&from, &to, "defer", args)) { return; } =20 @@ -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"); =20 + migrate_incoming_qmp(to, uri, NULL, "{}"); migrate_qmp(from, to, uri, NULL, "{}"); =20 if (should_fail) { - qtest_set_expected_status(to, EXIT_FAILURE); wait_for_migration_fail(from, true); } else { wait_for_migration_complete(from); diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index f17dc5176d..c6c8ae3004 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -545,8 +545,7 @@ static void test_multifd_tcp_cancel(MigrateCommon *args= , bool postcopy_ram) migrate_cancel(from); =20 /* Make sure QEMU process "to" exited */ - qtest_set_expected_status(to, EXIT_FAILURE); - qtest_wait_qemu(to); + migration_event_wait(to, "failed"); qtest_quit(to); =20 /* @@ -634,7 +633,7 @@ static void test_cancel_src_after_cancelled(QTestState = *from, QTestState *to, const char *uri, const char *p= hase, MigrateStart *args) { - migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); + migrate_incoming_qmp(to, uri, NULL, "{}"); =20 wait_for_serial("src_serial"); migrate_ensure_converge(from); @@ -659,7 +658,7 @@ static void test_cancel_src_after_complete(QTestState *= from, QTestState *to, const char *uri, const char *ph= ase, MigrateStart *args) { - migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); + migrate_incoming_qmp(to, uri, NULL, "{}"); =20 wait_for_serial("src_serial"); migrate_ensure_converge(from); @@ -690,7 +689,7 @@ static void test_cancel_src_after_none(QTestState *from= , QTestState *to, wait_for_serial("src_serial"); migrate_cancel(from); =20 - migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); + migrate_incoming_qmp(to, uri, NULL, "{}"); =20 migrate_ensure_converge(from); migrate_qmp(from, to, uri, NULL, "{}"); @@ -709,7 +708,7 @@ static void test_cancel_src_pre_switchover(QTestState *= from, QTestState *to, migrate_set_capability(from, "multifd", true); migrate_set_capability(to, "multifd", true); =20 - migrate_incoming_qmp(to, uri, NULL, "{ 'exit-on-error': false }"); + migrate_incoming_qmp(to, uri, NULL, "{}"); =20 wait_for_serial("src_serial"); migrate_ensure_converge(from); @@ -1101,7 +1100,6 @@ static void test_dirty_limit(char *name, MigrateCommo= n *args) =20 /* destination always fails after cancel */ migration_event_wait(to, "failed"); - qtest_set_expected_status(to, EXIT_FAILURE); qtest_quit(to); =20 /* Check if dirty limit throttle switched off, set timeout 1ms */ diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-= tests.c index 4ce7f6c676..87898af260 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -441,10 +441,10 @@ static void test_precopy_unix_tls_x509_default_host(c= har *name, g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); =20 args->connect_uri =3D uri; - args->listen_uri =3D uri; + args->listen_uri =3D "defer"; args->start_hook =3D migrate_hook_start_tls_x509_default_host; args->end_hook =3D migrate_hook_end_tls_x509; - args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; + args->result =3D MIG_TEST_FAIL; =20 args->start.hide_stderr =3D true; =20 @@ -522,10 +522,11 @@ migrate_hook_start_tls_x509_no_host(QTestState *from,= QTestState *to) =20 static void test_precopy_tcp_tls_no_hostname(char *name, MigrateCommon *ar= gs) { - args->listen_uri =3D "tcp:127.0.0.1:0"; + args->listen_uri =3D "defer"; + args->connect_uri =3D "tcp:127.0.0.1:0"; args->start_hook =3D migrate_hook_start_tls_x509_no_host; args->end_hook =3D migrate_hook_end_tls_x509; - args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; + args->result =3D MIG_TEST_FAIL; =20 args->start.hide_stderr =3D true; =20 @@ -556,10 +557,11 @@ static void test_precopy_tcp_tls_x509_override_host(c= har *name, static void test_precopy_tcp_tls_x509_mismatch_host(char *name, MigrateCommon *args) { - args->listen_uri =3D "tcp:127.0.0.1:0"; + args->listen_uri =3D "defer"; + args->connect_uri =3D "tcp:127.0.0.1:0"; args->start_hook =3D migrate_hook_start_tls_x509_mismatch_host; args->end_hook =3D migrate_hook_end_tls_x509; - args->result =3D MIG_TEST_FAIL_DEST_QUIT_ERR; + args->result =3D MIG_TEST_FAIL; =20 args->start.hide_stderr =3D true; =20 --=20 2.51.0 From nobody Mon Apr 6 21:32:56 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1773771885; cv=none; d=zohomail.com; s=zohoarc; b=d6bwtIb09dDQMgacCPGitzoP+nNLBCbmMvS1s86VAxWk53KgkANUlcuHd5lEjCkN9696yawNagMhsy7l24Noocnaq+n28Lny9KXEPxwgvJOqClPt4LIZdNySmIaRwtpjkcFF1IPJOibDhqzwzbXk1zJj43UnFKwe/XVms2YHjHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773771885; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zP8ZJ3QpNGvxRsk4L1xTZiyzIagnWWTaRBbLo+IETtY=; b=JQYVfKmdhVowG2bpUMeZHgl9RT1c5lYENiwTkqWKnETdE0Oz7SI00y/562FKXkzCLXnTpyzWzdghjpl2baZNyQq8IMVQ9RI5Mkz87ooHV/vaop+vutQIEHnqqiBH/D1h7LFY3ZzoryNRronpqSHHxhf3WgcAxDKb2pCIXKdb1FY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773771885806512.3807543727064; Tue, 17 Mar 2026 11:24:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Z5M-0004Z4-6r; Tue, 17 Mar 2026 14:24:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Z5J-0004U9-JK for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:24:06 -0400 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w2Z5G-00037E-54 for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:24:05 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C287F4D3BC; Tue, 17 Mar 2026 18:23:33 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2D67E4273B; Tue, 17 Mar 2026 18:23:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id wJgsOSOcuWnXdQAAD6G6ig (envelope-from ); Tue, 17 Mar 2026 18:23:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771813; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zP8ZJ3QpNGvxRsk4L1xTZiyzIagnWWTaRBbLo+IETtY=; b=rb8lHVnWDaBMVnC6Vcd3SnvZMwBXpPAg0yUoGVvmC2pdGx0TfW31/3loogG/uQARVoBNsD 5Qk7yjgYwocTaXCMwrmD5Wjj6KTpt45SBFPCDHyERfnzRvPC7zh8GSsQiPzvuxmgKrYSEM OPej+dDTBdZNHMH7JE7AyczRecC9kmc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771813; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zP8ZJ3QpNGvxRsk4L1xTZiyzIagnWWTaRBbLo+IETtY=; b=dxd0iau8L8PvSyrc3h2PXg78isEU3opRZedeZ3G8ykqihAcsLReUCKqFZd0+LNQ4IddN7u mkap20/0TC82HmAw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771813; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zP8ZJ3QpNGvxRsk4L1xTZiyzIagnWWTaRBbLo+IETtY=; b=rb8lHVnWDaBMVnC6Vcd3SnvZMwBXpPAg0yUoGVvmC2pdGx0TfW31/3loogG/uQARVoBNsD 5Qk7yjgYwocTaXCMwrmD5Wjj6KTpt45SBFPCDHyERfnzRvPC7zh8GSsQiPzvuxmgKrYSEM OPej+dDTBdZNHMH7JE7AyczRecC9kmc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771813; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zP8ZJ3QpNGvxRsk4L1xTZiyzIagnWWTaRBbLo+IETtY=; b=dxd0iau8L8PvSyrc3h2PXg78isEU3opRZedeZ3G8ykqihAcsLReUCKqFZd0+LNQ4IddN7u mkap20/0TC82HmAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Ani Sinha , Markus Armbruster , Prasad Pandit Subject: [PULL 06/10] migration: assert that the same migration handler is not being added twice Date: Tue, 17 Mar 2026 15:23:16 -0300 Message-ID: <20260317182320.31991-7-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317182320.31991-1-farosas@suse.de> References: <20260317182320.31991-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1773771889109154100 Content-Type: text/plain; charset="utf-8" From: Ani Sinha Currently the code that adds a migration blocker does not check if the same blocker already exists. Assert that the migration handler being added has not been added already. CC: Markus Armbruster CC: Peter Xu CC: Prasad Pandit Reviewed-by: Peter Xu Signed-off-by: Ani Sinha Link: https://lore.kernel.org/qemu-devel/20260311070114.164434-1-anisinha@r= edhat.com Signed-off-by: Fabiano Rosas --- migration/migration.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index c77832f851..7feeba804f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1699,6 +1699,8 @@ static int add_blockers(Error **reasonp, unsigned mod= es, Error **errp) { for (MigMode mode =3D 0; mode < MIG_MODE__MAX; mode++) { if (modes & BIT(mode)) { + assert(g_slist_index(migration_blockers[mode], + *reasonp) =3D=3D -1); migration_blockers[mode] =3D g_slist_prepend(migration_blocker= s[mode], *reasonp); } --=20 2.51.0 From nobody Mon Apr 6 21:32:56 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1773771886; cv=none; d=zohomail.com; s=zohoarc; b=IM32CjRqX3n2Z2GDS1YfPKJw+Q9notqq4LFVpsXi6h38zyBveZCXiXa36yiTmcYxhsyWFgGc7LWmaKfZACc2xA61KzcN/61GQEmsHmINxaBCCMKitjh7yKRukNe+OyNf7o2pDo1GgDHxN4Mtf85QCm0Iv/fk1C0d11lHBbp+pag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773771886; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zqaLLFRvAqv9HvFvoTB699fqhZJlGHS7AV1u0kLxxjY=; b=Nzuz76STx7OnKqpg3XqhD+8FspQsGhkChpfrhKxKcTa0m40fNYljUocqCmBLH2QuHqa70unGq/vk4pCR+SP8BQxNB6947MVLzk6XrAOCPcon6xYSA018EYPGT4Daj9OF7mTYcWTeNDXU46B6aVvYsgjif2baSv+5rQfKpJre6rg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773771886207241.3194950547005; Tue, 17 Mar 2026 11:24:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Z5n-0004o8-Fo; Tue, 17 Mar 2026 14:24:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Z5R-0004kD-54 for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:24:13 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w2Z5O-00038F-7Q for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:24:11 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id CFF444D3C0; Tue, 17 Mar 2026 18:23:35 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 396CE4273B; Tue, 17 Mar 2026 18:23:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id kDuEACacuWnXdQAAD6G6ig (envelope-from ); Tue, 17 Mar 2026 18:23:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771815; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zqaLLFRvAqv9HvFvoTB699fqhZJlGHS7AV1u0kLxxjY=; b=s0kdzWg26MpWCsTCGXZYiBmCtlF8i1SUzdQ1KxvI5bhcvLi6Z0vXOT2ox65HqsnXZ2eeeV 8BNB2ww0t6l7/NgqW3DzK4bCDmQh0VIxPvXMiNrvRQHSHQhK4TZHrmSNynXNekhY9J71iF wZU7x87hNVxBpCsYGtI0Xl8ymrVzwSk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771815; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zqaLLFRvAqv9HvFvoTB699fqhZJlGHS7AV1u0kLxxjY=; b=bIdY6/OthOj6+p6p15w4XQUr1HWTz9SbxKvXMsAabWZzi7t3zBFGYFCeqsh53W9KD4QGM2 SQCAbCuPooJqu9Bw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771815; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zqaLLFRvAqv9HvFvoTB699fqhZJlGHS7AV1u0kLxxjY=; b=s0kdzWg26MpWCsTCGXZYiBmCtlF8i1SUzdQ1KxvI5bhcvLi6Z0vXOT2ox65HqsnXZ2eeeV 8BNB2ww0t6l7/NgqW3DzK4bCDmQh0VIxPvXMiNrvRQHSHQhK4TZHrmSNynXNekhY9J71iF wZU7x87hNVxBpCsYGtI0Xl8ymrVzwSk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771815; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zqaLLFRvAqv9HvFvoTB699fqhZJlGHS7AV1u0kLxxjY=; b=bIdY6/OthOj6+p6p15w4XQUr1HWTz9SbxKvXMsAabWZzi7t3zBFGYFCeqsh53W9KD4QGM2 SQCAbCuPooJqu9Bw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Markus Armbruster , Peter Maydell , Prasad Pandit Subject: [PULL 07/10] migration/options: Fix leaks in StrOrNull qdev accessors Date: Tue, 17 Mar 2026 15:23:17 -0300 Message-ID: <20260317182320.31991-8-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317182320.31991-1-farosas@suse.de> References: <20260317182320.31991-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1773771889166154100 Content-Type: text/plain; charset="utf-8" Fix a couple of possible leaks detected by Coverity. Both are currently harmless. This code is only used for the very specific purpose of maintaining compatibility of a few migration options which can be set via QEMU command line (-global migration.tls-*). The command line interface is not supported and only used during development and testing. 1) The setter function set_StrOrNull() is invoked whenever the -global migration.tls-* command line options are set. The way it could leak is that the temporary "StrOrNull *str_or_null" object is allocated before calling the visitor, which could fail and cause an early return of the function, leaving *ptr unset and str_or_null leaking. 2) The getter function get_StrOrNull() is unreachable code. It's only there to provide a complete implementation of the property. Still, the way it could leak is that the temporary "StrOrNull *str_or_null" might be allocated and is simply never returned to the caller nor freed. Fix the possible leaks: 1) at set_StrOrNull(): change the allocation of str_or_null to happen only after the visit call has returned successfully. 2) at get_StrOrNull(): assert that the object is non-NULL, there is no need for a temporary object. The reason it should be non-NULL is that the property is initialized by the default setter of the qdev property. The initialization is unlikely to fail because the call to the setter is setup by qdev, which has boilerplate ensuring the to-be-set object is allocated and of the correct type. Moreover, passing NULL via command line to -global migration.tls-* is not possible. A programming error could result in an invalid call to the setter, which would leave the object NULL and cause a crash in the getter, but that's not a worthwhile scenario to protect against given the low probability of this code being even reached. While here, update the comment about why there's no QNULL in this StrOrNull property to be more clear. Fixes: CID 1643919 Fixes: CID 1643920 Cc: Markus Armbruster Reported-by: Peter Maydell Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260312204619.1969-1-farosas@suse= .de Signed-off-by: Fabiano Rosas --- migration/options.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/migration/options.c b/migration/options.c index f33b297929..658c578191 100644 --- a/migration/options.c +++ b/migration/options.c @@ -220,14 +220,12 @@ static void get_StrOrNull(Object *obj, Visitor *v, co= nst char *name, StrOrNull **ptr =3D object_field_prop_ptr(obj, prop); StrOrNull *str_or_null =3D *ptr; =20 - if (!str_or_null) { - str_or_null =3D g_new0(StrOrNull, 1); - str_or_null->type =3D QTYPE_QSTRING; - str_or_null->u.s =3D g_strdup(""); - } else { - /* the setter doesn't allow QNULL */ - assert(str_or_null->type !=3D QTYPE_QNULL); - } + /* + * The property should never be NULL because it's part of + * s->parameters and a default value is always set by qdev. It + * should also never be QNULL as the setter doesn't allow it. + */ + assert(str_or_null && str_or_null->type !=3D QTYPE_QNULL); visit_type_str(v, name, &str_or_null->u.s, errp); } =20 @@ -236,16 +234,25 @@ static void set_StrOrNull(Object *obj, Visitor *v, co= nst char *name, { const Property *prop =3D opaque; StrOrNull **ptr =3D object_field_prop_ptr(obj, prop); - StrOrNull *str_or_null =3D g_new0(StrOrNull, 1); + StrOrNull *str_or_null; + char *str; + + if (!visit_type_str(v, name, &str, errp)) { + return; + } =20 /* - * Only str to keep compatibility, QNULL was never used via - * command line. + * This property only applies to the command line usage of + * migration's TLS options (-global migration.tls-*) where the + * NULL value cannot be provided as input (only strings are + * allowed). Therefore, this StrOrNull implementation never + * produces a QNULL value to avoid ever returning values outside + * the range of what was previously handled by consumers of the + * TLS options. */ + str_or_null =3D g_new0(StrOrNull, 1); str_or_null->type =3D QTYPE_QSTRING; - if (!visit_type_str(v, name, &str_or_null->u.s, errp)) { - return; - } + str_or_null->u.s =3D str; =20 qapi_free_StrOrNull(*ptr); *ptr =3D str_or_null; --=20 2.51.0 From nobody Mon Apr 6 21:32:56 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1773771897; cv=none; d=zohomail.com; s=zohoarc; b=UPCPOjfjH9ZwBCnU+VhtEDxEn1KtZLWLfFXWhJKtMTfuTygGks83lrDXk8wkum5Dig01aYIQD4oHLjhWaF3gAmBAU/POp5Aub+PQczMW9nzPiTZKiQSRUewhKkOMAL773xiOdVPUeL46gA0HtrvtjgSm9eWLXhsfOeUencl3w/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773771897; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qDlmwArkCxjTT0GX8cOvaVkFYslbsSU3puMZfR93qBQ=; b=XT78+KKN30nbVQHFbPNISot6JAZL3/E0WsMjchL/vMT5ZcvfbwB20Dgb2qtf6poHBsbtsjQYssknk+N+wjt0/CLIEUtj3a4Sw23aUTTvCxOzeTkVpnAs6okezY8zADT/7YQi7qKqC003E+1rupeyMTHAHZvvEgRzen/pJvjXGN4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773771897116547.4469155763067; Tue, 17 Mar 2026 11:24:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Z5w-00053m-Iy; Tue, 17 Mar 2026 14:24:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Z5e-0004np-0U for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:24:27 -0400 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w2Z5W-00038l-AG for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:24:24 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6C36E4D3AD; Tue, 17 Mar 2026 18:23:37 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 469664273B; Tue, 17 Mar 2026 18:23:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id +H/FAyicuWnXdQAAD6G6ig (envelope-from ); Tue, 17 Mar 2026 18:23:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771817; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qDlmwArkCxjTT0GX8cOvaVkFYslbsSU3puMZfR93qBQ=; b=0b3vkuAJowkNZPoXa5ox7aIJcGVCxumBY4FqklFyZjvauI8So+sceqEWcV+5t/smO1ek5M dJVj+xCIkbRWoQMlL81cTt/IZaFuXMq3NF+bwzKtyoCAdZRaoQD3Xd6IZPEjMPQVXYTM6R 9SqneJatTvcvvXFQaCtvVQgDU1wwUD4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771817; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qDlmwArkCxjTT0GX8cOvaVkFYslbsSU3puMZfR93qBQ=; b=aR+8VCDmOZYY3XOR0cTS/X7GJJ+8PSS/dEzEh9k0m2k051el/6Uc6z13fC0Z0CTC6wAH9t FcJeZrvQJ2YiK0CQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771817; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qDlmwArkCxjTT0GX8cOvaVkFYslbsSU3puMZfR93qBQ=; b=0b3vkuAJowkNZPoXa5ox7aIJcGVCxumBY4FqklFyZjvauI8So+sceqEWcV+5t/smO1ek5M dJVj+xCIkbRWoQMlL81cTt/IZaFuXMq3NF+bwzKtyoCAdZRaoQD3Xd6IZPEjMPQVXYTM6R 9SqneJatTvcvvXFQaCtvVQgDU1wwUD4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771817; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qDlmwArkCxjTT0GX8cOvaVkFYslbsSU3puMZfR93qBQ=; b=aR+8VCDmOZYY3XOR0cTS/X7GJJ+8PSS/dEzEh9k0m2k051el/6Uc6z13fC0Z0CTC6wAH9t FcJeZrvQJ2YiK0CQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Aadeshveer Singh Subject: [PULL 08/10] migration: fix implicit integer division in migration_update_counters Date: Tue, 17 Mar 2026 15:23:18 -0300 Message-ID: <20260317182320.31991-9-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317182320.31991-1-farosas@suse.de> References: <20260317182320.31991-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; URIBL_BLOCKED(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid,suse.de:email]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[redhat.com,gmail.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Spam-Score: -2.80 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1773771898225158500 Content-Type: text/plain; charset="utf-8" From: Aadeshveer Singh switchover_bw is a uint64_t, so switchover_bw / 1000 results in an integer division. This value is then assigned to expected_bw_per_ms which is of type double. This results in losing precision and is type unsafe. Adding explicit cast ensures floating-point division. Signed-off-by: Aadeshveer Singh Reviewed-by: Peter Xu Link: https://lore.kernel.org/qemu-devel/20260316134509.157964-1-aadeshveer= 07@gmail.com Signed-off-by: Fabiano Rosas --- migration/migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 7feeba804f..5c9aaa6e58 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3141,7 +3141,7 @@ static void migration_update_counters(MigrationState = *s, * If the user specified a switchover bandwidth, let's trust the * user so that can be more accurate than what we estimated. */ - expected_bw_per_ms =3D switchover_bw / 1000; + expected_bw_per_ms =3D (double)switchover_bw / 1000; } else { /* If the user doesn't specify bandwidth, we use the estimated */ expected_bw_per_ms =3D bandwidth; --=20 2.51.0 From nobody Mon Apr 6 21:32:56 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1773771897; cv=none; d=zohomail.com; s=zohoarc; b=fF9Jx4l9WGNIqohJphh45Q5XlDqe22d4LRWiKOt0IYCq+9aJ1nvbUrgMwIyeRYVWtMI7M1tOfWwsCRGyfv1OUUZDNTQIOOzQFAKcFDFUck0dPnTFKl77CMcYO0+gK8QhGLY9d3UeQEupMAUv2UbYIDmQwXir4Bjb/jf+KjcbwG4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773771897; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XQWEuBKAi2YbC0czpsuizw7lRBNrGsjzEhd6lT/BdAI=; b=KY8UH+wTYfXRCPz9s+0KRXUUZdLiHCLBDekQ4grGigfho3qj30E7fk3nDoPuAYJOqV6UkWU72Zhc9bRYCpEemdqsIaS8tQyFGiHTLIi2ocr2bGlPY0S68stdjxXxJSGsSV07YgsF4+LR/zbphLmoV+MQzem/WUkrstLXMQCvX+Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773771897802611.5231825885422; Tue, 17 Mar 2026 11:24:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Z64-0005Ja-8C; Tue, 17 Mar 2026 14:24:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Z5p-0004wZ-Ew for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:24:39 -0400 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w2Z5j-0003AI-Ib for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:24:35 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 07C1F4D3B0; Tue, 17 Mar 2026 18:23:39 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D719D4273B; Tue, 17 Mar 2026 18:23:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id OHoIJymcuWnXdQAAD6G6ig (envelope-from ); Tue, 17 Mar 2026 18:23:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771819; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XQWEuBKAi2YbC0czpsuizw7lRBNrGsjzEhd6lT/BdAI=; b=uNOLZyARjwCia6K+VipW0qxlYkyVeGLh60WB6OYcGJ9q/4FZ04m0G4Nj/5GIor86SjyXld Mdtn8u93OftyN7lzguNBINrK85tRC+Rg7ELt1llW/WJCpElPVDdht1gZveFi54eb9zrDzk fko4Lb2q+XRe4omM64g886OTAXYiiBs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771819; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XQWEuBKAi2YbC0czpsuizw7lRBNrGsjzEhd6lT/BdAI=; b=/Zj3Vb/l+8kFKWqpoSwaMeGWvL9DpHXsHh0m74tMAc2Y6g88mSyWpEB0JOG6uCS38ZX5t4 +WsH7eNd4w7mrLDw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771819; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XQWEuBKAi2YbC0czpsuizw7lRBNrGsjzEhd6lT/BdAI=; b=uNOLZyARjwCia6K+VipW0qxlYkyVeGLh60WB6OYcGJ9q/4FZ04m0G4Nj/5GIor86SjyXld Mdtn8u93OftyN7lzguNBINrK85tRC+Rg7ELt1llW/WJCpElPVDdht1gZveFi54eb9zrDzk fko4Lb2q+XRe4omM64g886OTAXYiiBs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771819; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XQWEuBKAi2YbC0czpsuizw7lRBNrGsjzEhd6lT/BdAI=; b=/Zj3Vb/l+8kFKWqpoSwaMeGWvL9DpHXsHh0m74tMAc2Y6g88mSyWpEB0JOG6uCS38ZX5t4 +WsH7eNd4w7mrLDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 09/10] tests/qtest: Don't dup machine name in qtest_cb_for_every_machine callbacks Date: Tue, 17 Mar 2026 15:23:19 -0300 Message-ID: <20260317182320.31991-10-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317182320.31991-1-farosas@suse.de> References: <20260317182320.31991-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.30 X-Spamd-Result: default: False [-3.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.998]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, suse.de:mid, suse.de:email] Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1773771898256158500 The qtest_get_machines function caches the list of machines in a static variable. Dup'ing the machine->name string only serves to leak that memory when a single test is executed. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/qemu-devel/20260313182957.28432-2-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- tests/qtest/cpu-plug-test.c | 11 +++++------ tests/qtest/qom-test.c | 3 +-- tests/qtest/test-hmp.c | 3 +-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/qtest/cpu-plug-test.c b/tests/qtest/cpu-plug-test.c index 0aa4ccc5b6..e68f39cf56 100644 --- a/tests/qtest/cpu-plug-test.c +++ b/tests/qtest/cpu-plug-test.c @@ -14,7 +14,7 @@ #include "qobject/qlist.h" =20 struct PlugTestData { - char *machine; + const char *machine; const char *cpu_model; char *device_model; unsigned sockets; @@ -73,7 +73,6 @@ static void test_data_free(gpointer data) { PlugTestData *pc =3D data; =20 - g_free(pc->machine); g_free(pc->device_model); g_free(pc); } @@ -87,7 +86,7 @@ static void add_pc_test_case(const char *mname) return; } data =3D g_new(PlugTestData, 1); - data->machine =3D g_strdup(mname); + data->machine =3D mname; data->cpu_model =3D "Haswell"; /* 1.3+ theoretically */ data->device_model =3D g_strdup_printf("%s-%s-cpu", data->cpu_model, qtest_get_arch()); @@ -114,7 +113,7 @@ static void add_pseries_test_case(const char *mname) return; } data =3D g_new(PlugTestData, 1); - data->machine =3D g_strdup(mname); + data->machine =3D mname; data->cpu_model =3D "power8_v2.0"; data->device_model =3D g_strdup("power8_v2.0-spapr-cpu-core"); data->sockets =3D 2; @@ -140,7 +139,7 @@ static void add_s390x_test_case(const char *mname) } =20 data =3D g_new(PlugTestData, 1); - data->machine =3D g_strdup(mname); + data->machine =3D mname; data->cpu_model =3D "qemu"; data->device_model =3D g_strdup("qemu-s390x-cpu"); data->sockets =3D 1; @@ -162,7 +161,7 @@ static void add_loongarch_test_case(const char *mname) PlugTestData *data; =20 data =3D g_new(PlugTestData, 1); - data->machine =3D g_strdup(mname); + data->machine =3D mname; data->cpu_model =3D "la464"; data->device_model =3D g_strdup("la464-loongarch-cpu"); data->sockets =3D 1; diff --git a/tests/qtest/qom-test.c b/tests/qtest/qom-test.c index 2da9918e16..6421f2d9d9 100644 --- a/tests/qtest/qom-test.c +++ b/tests/qtest/qom-test.c @@ -216,7 +216,6 @@ static void test_machine(gconstpointer data) test_list_get_value(qts); =20 qtest_quit(qts); - g_free((void *)machine); } =20 static void add_machine_test_case(const char *mname) @@ -224,7 +223,7 @@ static void add_machine_test_case(const char *mname) char *path; =20 path =3D g_strdup_printf("qom/%s", mname); - qtest_add_data_func(path, g_strdup(mname), test_machine); + qtest_add_data_func(path, mname, test_machine); g_free(path); } =20 diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c index 1b2e07522f..60f742e83f 100644 --- a/tests/qtest/test-hmp.c +++ b/tests/qtest/test-hmp.c @@ -135,7 +135,6 @@ static void test_machine(gconstpointer data) =20 qtest_quit(qts); g_free(args); - g_free((void *)data); } =20 static void add_machine_test_case(const char *mname) @@ -143,7 +142,7 @@ static void add_machine_test_case(const char *mname) char *path; =20 path =3D g_strdup_printf("hmp/%s", mname); - qtest_add_data_func(path, g_strdup(mname), test_machine); + qtest_add_data_func(path, mname, test_machine); g_free(path); } =20 --=20 2.51.0 From nobody Mon Apr 6 21:32:56 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1773771916; cv=none; d=zohomail.com; s=zohoarc; b=EJrIvR57vUmuLk6Oi2mfNYtS9IMSmcj8F+LL//FCrBk/XFptvNdrtdXf3KQ+2KgKbIWNf+kYi3fz3gnGKW2DxlQZy3lXT/lMAsoMZwhdqqe6uQRMlM9AwE3lFuo7ja/ngc/eMs98aGV2/ho/KEMxU1N/5pVk42fxeygLapa5w2U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773771916; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VTcNFzzFpoGcy8nkDI1dnntuxUKTk+BUX6k55MUpSDo=; b=YWD+0jLIkfXEsj9xjeIvxlmPOTG7ghnzsdYdQGpfXzP63knDtmQcD7MVvE+a9Q2LODRYSBAaOZ3rUTWx5hnMSeHP1VCBv8T9ZjgLdE04pS8o4cC5fVCzhAY7wwTvfPL4qgd41NKXzLdtFG8Vcyr6M+B2wRgfUWe6rOSfP851k9U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773771916221885.9495699999453; Tue, 17 Mar 2026 11:25:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Z64-0005ZD-Rs; Tue, 17 Mar 2026 14:24:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Z5y-0005Fa-6t for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:24:46 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w2Z5u-0003CF-N7 for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:24:45 -0400 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 98DA34D3C2; Tue, 17 Mar 2026 18:23:40 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 737554273B; Tue, 17 Mar 2026 18:23:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id uF6tDiucuWnXdQAAD6G6ig (envelope-from ); Tue, 17 Mar 2026 18:23:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771820; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VTcNFzzFpoGcy8nkDI1dnntuxUKTk+BUX6k55MUpSDo=; b=Jk3XIIoKQIWUcKsZbFMUBOHnE0Mv5zwgo9g8YEMM2DMnz9+2cRhnvIX+WNi1edsvTB5a9b IF6czR9zjpJaJ9m3Xo0iaNvXee3tKYLOfIpNm7w/tTU9aQe6FSCzDqxsskoo57VATpLDDZ GsoGLH/yR+douBzGIDYSgT3CJin+Szw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771820; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VTcNFzzFpoGcy8nkDI1dnntuxUKTk+BUX6k55MUpSDo=; b=M9HtGSe91CbciaWvA6ONE7x7sOkdw+bOTNI7SlVzSP54jTfJaneE4sA70gnlq3gGU6wNP8 UTSw5kpVCfNW3+Cw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771820; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VTcNFzzFpoGcy8nkDI1dnntuxUKTk+BUX6k55MUpSDo=; b=Jk3XIIoKQIWUcKsZbFMUBOHnE0Mv5zwgo9g8YEMM2DMnz9+2cRhnvIX+WNi1edsvTB5a9b IF6czR9zjpJaJ9m3Xo0iaNvXee3tKYLOfIpNm7w/tTU9aQe6FSCzDqxsskoo57VATpLDDZ GsoGLH/yR+douBzGIDYSgT3CJin+Szw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771820; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VTcNFzzFpoGcy8nkDI1dnntuxUKTk+BUX6k55MUpSDo=; b=M9HtGSe91CbciaWvA6ONE7x7sOkdw+bOTNI7SlVzSP54jTfJaneE4sA70gnlq3gGU6wNP8 UTSw5kpVCfNW3+Cw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 10/10] tests/qtest/test-hmp: Free machine options Date: Tue, 17 Mar 2026 15:23:20 -0300 Message-ID: <20260317182320.31991-11-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317182320.31991-1-farosas@suse.de> References: <20260317182320.31991-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.30 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.998]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; URIBL_BLOCKED(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo,linaro.org:email]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, suse.de:mid, suse.de:email] X-Spam-Score: -3.30 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1773771942826154100 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/qemu-devel/20260313182957.28432-3-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- tests/qtest/test-hmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c index 60f742e83f..a523dbb446 100644 --- a/tests/qtest/test-hmp.c +++ b/tests/qtest/test-hmp.c @@ -149,6 +149,7 @@ static void add_machine_test_case(const char *mname) int main(int argc, char **argv) { char *v_env =3D getenv("V"); + g_autofree char *machine_opts =3D g_strdup("none -m 2"); =20 if (v_env && atoi(v_env) >=3D 2) { verbose =3D true; @@ -159,7 +160,7 @@ int main(int argc, char **argv) qtest_cb_for_every_machine(add_machine_test_case, g_test_quick()); =20 /* as none machine has no memory by default, add a test case with memo= ry */ - qtest_add_data_func("hmp/none+2MB", g_strdup("none -m 2"), test_machin= e); + qtest_add_data_func("hmp/none+2MB", machine_opts, test_machine); =20 return g_test_run(); } --=20 2.51.0