From nobody Sat Sep 26 20:51:04 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=1789081399; cv=none; d=zohomail.com; s=zohoarc; b=GEWZWfi2/GKlbp1cR8/jRK1WgndUskJbrN7GoX9v5bxgPWyaJMa8n+AM+gmIYJE1XETiR6PmtaBM60gQ51bIz6G7qnidOuaMXbZtKzXWl4/vUaTlAQ9TnDFeTVtZ2tmVWtWQhGwUYMZkT+3UrIxswbk9pXqO48Ls/qHoBoC6ul0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789081399; 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=n4TLleifm53fumqGFqc8qfNxZWFzGu+6SGnfZNiSSfI=; b=WmZFgCMwWoTCxmUEbP3DZRubKghPT7AOAahW2/fGopNOOtZuwGmM1S/lFpKz9QZnyy6b0yHazD5DGvYGlVQPH9Zi0EdPXBzB2qcykpdU4Kdg02bo+T8mLmdgqup9k+MxKpDDDpTEzRfBEHYBmhQICY1gzT8+489SxHZ/zjUUVEM= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789081399870870.9706884588122; Thu, 10 Sep 2026 16:03:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4nYj-0003P9-KX; Thu, 10 Sep 2026 18:48:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x4lN7-0003NY-Un for qemu-devel@nongnu.org; Thu, 10 Sep 2026 16:28:11 -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 1x4lMm-000168-SA for qemu-devel@nongnu.org; Thu, 10 Sep 2026 16:27:39 -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 24B7321D97; Thu, 10 Sep 2026 20:26:08 +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 E9885137FD; Thu, 10 Sep 2026 20:26:06 +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 KG0tLl4So2pJPQAAD6G6ig (envelope-from ); Thu, 10 Sep 2026 20:26:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789071972; 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=n4TLleifm53fumqGFqc8qfNxZWFzGu+6SGnfZNiSSfI=; b=c+nFBlTAbuuBYA8Qh+fK0VzhTiaTjvHwitXVJYVAcRu55akz2pDAkzDxngO8imcEL4w3Rj m+2oZGs7WEuFmDj7EnjzEsTiWrn6Sa5mxjjPrKB227iccVY1HIaOBUwkjYH6X7/46ZA9pL R4QmUEgBd8ArMvD+6ZpqfaPYw/9CgAI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789071972; 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=n4TLleifm53fumqGFqc8qfNxZWFzGu+6SGnfZNiSSfI=; b=I0FJB6EJQTtnsE3/dylzXp5Lx5D6XoQUKX2XUkZJC6THKH2gYpOOoK8OnB79ri8KzaO/H8 DhJj3+8XiTCMKiDA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789071968; 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=n4TLleifm53fumqGFqc8qfNxZWFzGu+6SGnfZNiSSfI=; b=RXfSfDJYzxAJRAl/aEDUDQIh4W7l+K/kr5F+9hrSekdW6cssNZ/brq09R3naj+8oS22Xv9 QeQDg58r1BmElTaimfPkWiJ5MYYEEc38QwGkJjcrks+2GyCI2n7tegbzbJkOvrErDFELUH 9/D1obTaGRvEI/ftKMnqwhrLatysEqE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789071968; 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=n4TLleifm53fumqGFqc8qfNxZWFzGu+6SGnfZNiSSfI=; b=Ow2q6WoolqzMOyPXueisMipAs9c4bGd7uR++p4zF8sjRp687QN3HA72+hOBjBDbSKSZOgE b1aSc/4WczsHocCA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Christian Quante , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 1/7] tests/qtest/fdc-test: give each test case its own QEMU instance Date: Thu, 10 Sep 2026 17:25:53 -0300 Message-ID: <20260910202559.916866-2-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260910202559.916866-1-farosas@suse.de> References: <20260910202559.916866-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.996]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; 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]; 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)[quante.one:email, suse.de:email, suse.de:mid, imap1.dmz-prg2.suse.org:helo] 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=lists1p.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) (identity @suse.de) X-ZM-MESSAGEID: 1789081402501158500 From: Christian Quante The test cases share one QEMU instance and, with it, the state of the floppy controller. Several of them therefore only pass in the order they happen to be registered in: test_read_no_dma_1, _18 and _19 read the medium that test_media_insert leaves in the drive, so running any of them on its own fails. fuzz-registers is worse -- it writes 1000 random values to the eight I/O ports at FLOPPY_BASE and restores none of them, which is harmless only because it is the last test case to run in the shared instance; the two registered after it start one of their own. Moving it anywhere else leaves an unacknowledged interrupt behind and the next test dies in send_seek(). Register the test cases from a table instead, through a wrapper that starts a QEMU instance, runs one test and stops it again. The test functions are unchanged: they reach the current instance through global_qtest, which qtest_start() reassigns for every test. The three read_no_dma tests now insert their own medium, and test_read_id no longer ejects at the end -- it did that only to leave the drive as the next test expected to find it. The two CVE test cases keep qtest_add_func(); they already run a QEMU instance of their own and do not use global_qtest. The same pattern is used by tests/qtest/boot-serial-test.c. Every test case now passes on its own, and the suite passes with the registration order reversed. Signed-off-by: Christian Quante Tested-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Fabiano Rosas --- tests/qtest/fdc-test.c | 71 ++++++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 20 deletions(-) diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c index 1e1dd8659d..fd38475bf7 100644 --- a/tests/qtest/fdc-test.c +++ b/tests/qtest/fdc-test.c @@ -510,9 +510,6 @@ static void test_read_id(void) g_assert_cmpint(cyl, =3D=3D, 8); g_assert_cmpint(head, =3D=3D, 1); g_assert_cmpint(st0, =3D=3D, head << 2); - - /* Leave the drive empty, the way the machine starts up. */ - media_eject(); } =20 /* @@ -552,6 +549,7 @@ static void test_read_no_dma_1(void) { uint8_t ret; =20 + media_insert(); outb(FLOPPY_BASE + reg_dor, inb(FLOPPY_BASE + reg_dor) & ~0x08); send_seek(0); ret =3D send_read_no_dma_command(1, 0x04); @@ -562,6 +560,7 @@ static void test_read_no_dma_18(void) { uint8_t ret; =20 + media_insert(); outb(FLOPPY_BASE + reg_dor, inb(FLOPPY_BASE + reg_dor) & ~0x08); send_seek(0); ret =3D send_read_no_dma_command(18, 0x04); @@ -572,6 +571,7 @@ static void test_read_no_dma_19(void) { uint8_t ret; =20 + media_insert(); outb(FLOPPY_BASE + reg_dor, inb(FLOPPY_BASE + reg_dor) & ~0x08); send_seek(0); ret =3D send_read_no_dma_command(19, 0x20); @@ -656,10 +656,53 @@ static void test_cve_2021_3507(void) qtest_quit(s); } =20 +/* + * Each test gets its own QEMU instance, so that none of them depends on t= he + * state another one left behind. Without this, several tests only pass in + * the order they happen to be registered in: the read_no_dma tests need t= he + * medium that test_media_insert leaves in the drive, and fuzz-registers + * writes random values to the eight I/O ports at FLOPPY_BASE and restores + * none of them. + */ +typedef struct { + const char *path; + void (*fn)(void); +} FDCTest; + +static const FDCTest fdc_tests[] =3D { + { "/fdc/cmos", test_cmos }, + { "/fdc/no_media_on_start", test_no_media_on_start }, + { "/fdc/read_without_media", test_read_without_media }, + { "/fdc/media_change", test_media_change }, + { "/fdc/sense_interrupt", test_sense_interrupt }, + { "/fdc/relative_seek", test_relative_seek }, + { "/fdc/read_id", test_read_id }, + { "/fdc/read_id_no_media", test_read_id_no_media }, + { "/fdc/verify", test_verify }, + { "/fdc/media_insert", test_media_insert }, + { "/fdc/read_no_dma_1", test_read_no_dma_1 }, + { "/fdc/read_no_dma_18", test_read_no_dma_18 }, + { "/fdc/read_no_dma_19", test_read_no_dma_19 }, + { "/fdc/fuzz-registers", fuzz_registers }, +}; + +static void run_isolated(const void *data) +{ + const FDCTest *test =3D data; + + qtest_start("-machine pc -device floppy,id=3Dfloppy0"); + qtest_irq_intercept_in(global_qtest, "ioapic"); + + test->fn(); + + qtest_end(); +} + int main(int argc, char **argv) { int fd; int ret; + size_t i; =20 /* Create a temporary raw image */ fd =3D g_file_open_tmp("qtest.XXXXXX", &test_image, NULL); @@ -671,29 +714,17 @@ int main(int argc, char **argv) /* Run the tests */ g_test_init(&argc, &argv, NULL); =20 - qtest_start("-machine pc -device floppy,id=3Dfloppy0"); - qtest_irq_intercept_in(global_qtest, "ioapic"); - qtest_add_func("/fdc/cmos", test_cmos); - qtest_add_func("/fdc/no_media_on_start", test_no_media_on_start); - qtest_add_func("/fdc/read_without_media", test_read_without_media); - qtest_add_func("/fdc/media_change", test_media_change); - qtest_add_func("/fdc/sense_interrupt", test_sense_interrupt); - qtest_add_func("/fdc/relative_seek", test_relative_seek); - qtest_add_func("/fdc/read_id", test_read_id); - qtest_add_func("/fdc/read_id_no_media", test_read_id_no_media); - qtest_add_func("/fdc/verify", test_verify); - qtest_add_func("/fdc/media_insert", test_media_insert); - qtest_add_func("/fdc/read_no_dma_1", test_read_no_dma_1); - qtest_add_func("/fdc/read_no_dma_18", test_read_no_dma_18); - qtest_add_func("/fdc/read_no_dma_19", test_read_no_dma_19); - qtest_add_func("/fdc/fuzz-registers", fuzz_registers); + for (i =3D 0; i < ARRAY_SIZE(fdc_tests); i++) { + qtest_add_data_func(fdc_tests[i].path, &fdc_tests[i], run_isolated= ); + } + + /* These use a QTestState of their own instead of global_qtest */ qtest_add_func("/fdc/fuzz/cve_2021_20196", test_cve_2021_20196); qtest_add_func("/fdc/fuzz/cve_2021_3507", test_cve_2021_3507); =20 ret =3D g_test_run(); =20 /* Cleanup */ - qtest_end(); unlink(test_image); g_free(test_image); =20 --=20 2.53.0 From nobody Sat Sep 26 20:51:04 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=1789075906; cv=none; d=zohomail.com; s=zohoarc; b=N6QrmfBB6K1lv6tdjKV+D9csUSFN6x+usiRTYDmiTffVNjshg4i8pAcX58X8syECSklUin3HbmjrMzz5vuYz8/5FZJOA6oWvQKKoB3pEDNEKSLTDsC5PxQPk4F3tiBeGoX8i8e5h+MJGjaow5nK+e8UE8kpvdsvybwYix33xsSU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789075906; 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=lCKcpItZ3rarcJaUARK6pl3h137OPzjExEVzJ/bAK0c=; b=EJq4rmTcq3ry/bm+vvK+fdkmTGGG4JxabEEVyVcELPRYcSM3Uixgl43YXYFOM9AxH0cpB836lqWYgj2tp0HX8IfsuJQ29HL0G+3M6qhvtPADmACPDr5hyP2XmEvtMvQ+71Yd2xQZ0oUO9DN+gtBJYj/LnZ4RfJq0utXcRq2seSY= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789075906903198.46030188453983; Thu, 10 Sep 2026 14:31:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4mHl-0000nW-3k; Thu, 10 Sep 2026 17:26:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x4lTh-0005uE-Vn for qemu-devel@nongnu.org; Thu, 10 Sep 2026 16:35:00 -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 1x4lTR-0002cy-5P for qemu-devel@nongnu.org; Thu, 10 Sep 2026 16:34:29 -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 6871621EB5; Thu, 10 Sep 2026 20:26:09 +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 3933913955; Thu, 10 Sep 2026 20:26:08 +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 sFEoA2ASo2pJPQAAD6G6ig (envelope-from ); Thu, 10 Sep 2026 20:26:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789071973; 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=lCKcpItZ3rarcJaUARK6pl3h137OPzjExEVzJ/bAK0c=; b=zMF/tLeEO06+xtpPkp9y5+mZVd1Cqufrg/NpW6yyiA8de7dD7XPhO1N472ESX0rI+wShOk YxpenbpA0PJbX9EeGlGK/DFxqP7ufW/zrHzCO0U2IlHUuJKCYHYeSeqWh24LzOzCdsUmJP jqMR3kv1C0WSTKslqV7w9TeJGbQ+l9c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789071973; 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=lCKcpItZ3rarcJaUARK6pl3h137OPzjExEVzJ/bAK0c=; b=gOmpEVZ2Q8txOLrq5Xb3ZtCE+yMhO1jyODPI8PAmQHlTGZ6LyJ9mdltdW5HMKD0T/fEUzl JtiHYE6g+QlePgBg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789071969; 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=lCKcpItZ3rarcJaUARK6pl3h137OPzjExEVzJ/bAK0c=; b=hzesXkTKeY+yt+7cYkUX5ll5GKbcL4VqbLA0g3AoEof7UGOPekYWA9pK1W0BKI3V885vY8 fc06p+eulugJGR9xmcAowRXdyiLFMsh3/eIXC5wDfROMPhzf6uW+9nacNXsjX410PE+fnO nlHih3dpH69rTsw8UCaZaZmloW0a7kA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789071969; 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=lCKcpItZ3rarcJaUARK6pl3h137OPzjExEVzJ/bAK0c=; b=Yubk7ixzsax5JSExV/vdt+W3OuwMmIAYS+xTKij4aBdBVfmyR2UoCqNmM/5UXIZJylJWpk ynzkIvJZhnACQ1BA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Christian Quante , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 2/7] tests/qtest/fdc-test: skip test cases when the 'pc' machine is missing Date: Thu, 10 Sep 2026 17:25:54 -0300 Message-ID: <20260910202559.916866-3-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260910202559.916866-1-farosas@suse.de> References: <20260910202559.916866-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)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.996]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; 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]; 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)[suse.de:email, suse.de:mid, imap1.dmz-prg2.suse.org:helo, quante.one: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=lists1p.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: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, 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: 1789075909301158500 From: Christian Quante run_isolated() starts every test case in fdc_tests[] with "-machine pc". A QEMU built without the i440fx/pc machine fails them with "unsupported machine type 'pc'" rather than skipping them. Check for the machine in run_isolated() and skip there. The previous patch routed every table entry through that one function, so one check covers all of them; 4e37f749dd ("tests/qtest/drive_del-test: skip pc tests when 'pc' machine is unavailable") needed the same three lines four times over. The two CVE test cases are left alone. They start QEMU without -machine and so ask for the default machine, which is a separate question from the one this patch answers. Signed-off-by: Christian Quante Tested-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Fabiano Rosas --- tests/qtest/fdc-test.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c index fd38475bf7..f480f4ba09 100644 --- a/tests/qtest/fdc-test.c +++ b/tests/qtest/fdc-test.c @@ -690,6 +690,11 @@ static void run_isolated(const void *data) { const FDCTest *test =3D data; =20 + if (!qtest_has_machine("pc")) { + g_test_skip("Machine 'pc' is not available"); + return; + } + qtest_start("-machine pc -device floppy,id=3Dfloppy0"); qtest_irq_intercept_in(global_qtest, "ioapic"); =20 --=20 2.53.0 From nobody Sat Sep 26 20:51:04 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=1789077473; cv=none; d=zohomail.com; s=zohoarc; b=DfCCXsTBAi+vF+nbPt2Z/K2TWfAesQwkHI/7V8MzqNO0VQRU03SqWPj0WhrxhME7JDuyV3dtQg4m+M0Kj/xjw5HgNDrltwyCth4n5FPXCt9s0URGVScqBsPwZHl9/2PJpop1hrMTfwzVxld5JIbNiFX+szuy+Ds930oNrJxuQEw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789077473; 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=fHOUSNPgHp+ou5TCOsUhOhq0vr6Hn9TKw3iNsrm+f10=; b=OiQPkwyGovmg/DmtBV2AsVZRaYThoRPAOsMN8UXUTKrdy+0Um82CXhqXYZNJfopk2DP1knh+pKm7tsmtmzjKTIxDXoB1nLIcIozF/PiZPFoS/xMZs1eRAopIOlEpQGtrE9xeNychRqn54vtKedmwJyCbXzxjz4gg/Yd4noC9D6Y= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789077473910280.9784583142672; Thu, 10 Sep 2026 14:57:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4mhD-00063y-46; Thu, 10 Sep 2026 17:52:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x4lN8-0003Nc-0N for qemu-devel@nongnu.org; Thu, 10 Sep 2026 16:28:11 -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 1x4lMw-00016g-Gn for qemu-devel@nongnu.org; Thu, 10 Sep 2026 16:27:47 -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 B41E121E64; Thu, 10 Sep 2026 20:26:10 +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 7CD1213A5A; Thu, 10 Sep 2026 20:26:09 +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 +MmsE2ESo2pJPQAAD6G6ig (envelope-from ); Thu, 10 Sep 2026 20:26:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789071977; 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=fHOUSNPgHp+ou5TCOsUhOhq0vr6Hn9TKw3iNsrm+f10=; b=sd0TsHydb25gLHrCBJh296ZVF505wXimyL7J6VXTUAnPOPDaMXR51/R26qKTLkHMNsuagf WuRQmkyBxEvl/xkxMpc4DQ2qCayuQqqa6EfaYinAcD2QhDuYctJ0hnWkV5Ynpd+4Bsp2aa WXSXSVLsO0UnYh/ni1mLnR0f3SeR9Tw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789071977; 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=fHOUSNPgHp+ou5TCOsUhOhq0vr6Hn9TKw3iNsrm+f10=; b=aWHL341hyaXBGdVQB926jiPS0QOY6LNLnVbGS3L0UoC2yoSmvxC83iN+wJkw7mt5n+gtHf xnjXYVnjwcY8YeBQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=mXeSFvom; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=bppyYIvV DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789071971; 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=fHOUSNPgHp+ou5TCOsUhOhq0vr6Hn9TKw3iNsrm+f10=; b=mXeSFvomQswIXp2dPKXlN0QeyObLBbEOqHa8L7vWPmRhWg/XvFaSMJfiVEKXq4ASJLvMQZ iSt+98jcqtccusVVW+4r+pP4AHvRNnNFYBY/8dey+NvX68rv/Jzsu1CnNChoqZbxgobuQ/ rWmXx61V2aRt//2WvstejQGyEPJhPcw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789071971; 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=fHOUSNPgHp+ou5TCOsUhOhq0vr6Hn9TKw3iNsrm+f10=; b=bppyYIvVCP7BDkYRvVLcMeA89dHoKCXsODxezVHb+GwvbVUmVwbhCD5GLh+le3DiTW6qu0 DAnUfuoPEFeUmDAg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Christian Quante , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 3/7] tests/qtest/fdc-test: check that READ ID answers for the drive it names Date: Thu, 10 Sep 2026 17:25:55 -0300 Message-ID: <20260910202559.916866-4-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260910202559.916866-1-farosas@suse.de> References: <20260910202559.916866-1-farosas@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: B41E121E64 X-Spamd-Result: default: False [-3.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; 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)[-0.999]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(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:dkim,suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,quante.one:email,st1.ma:url]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.51 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=lists1p.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: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, 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: 1789077481524158500 From: Christian Quante Commit d00567f7fb ("hw/block/fdc: select the drive named by the READ ID command") added the missing SET_CUR_DRV() to fdctrl_handle_readid(), but nothing keeps it there: the suite runs a machine with a single floppy drive, where answering for the wrong drive cannot be told from answering for the right one. Removing the call again leaves every existing test case green. Add a test case on a machine with two drives. Drive 0 holds a medium and is selected by a SEEK, the way a driver spinning up the motor would select it; drive 1 is empty. READ ID is then issued for drive 1, and two independent properties of the answer have to hold: fdctrl_stop_transfer() reports the drive in ST0, and an empty drive terminates abnormally with ST1.MA. Without the fix the controller answers for drive 0, which terminates normally with ST0 =3D 0x00. Test cases carry their own command line, so that a test can ask for something other than the default single drive. Both command lines name the pc machine, so the check added by the previous patch still covers every test case. Signed-off-by: Christian Quante Tested-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Fabiano Rosas --- tests/qtest/fdc-test.c | 81 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 15 deletions(-) diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c index f480f4ba09..33d1b83aeb 100644 --- a/tests/qtest/fdc-test.c +++ b/tests/qtest/fdc-test.c @@ -67,6 +67,7 @@ enum { enum { ST0_IC_MASK =3D 0xc0, /* interrupt code */ ST0_IC_ABNTERM =3D 0x40, /* abnormal termination */ + ST0_DS_MASK =3D 0x03, /* drive the answer is about */ =20 ST1_MA =3D 0x01, /* missing address mark */ }; @@ -545,6 +546,47 @@ static void test_read_id_no_media(void) g_assert_cmpint(st1 & ST1_MA, =3D=3D, ST1_MA); } =20 +/* + * READ ID carries the drive number in its command byte and has to latch i= t. + * A controller that fails to do so answers for whichever drive was select= ed + * last. Here drive 0 holds a medium and is selected by the SEEK; drive 1= is + * empty, so answering for the wrong drive terminates normally (ST0 =3D 0x= 00) + * where the command has to fail, and names drive 0 rather than drive 1. + */ +static void test_read_id_other_drive(void) +{ + uint8_t drive =3D 1; + uint8_t head =3D 0; + uint8_t st0, st1; + + media_insert(); + + /* SEEK latches drive 0, the way a driver spinning up the motor would = */ + send_seek(0); + + floppy_send(CMD_READ_ID); + g_assert(!get_irq(FLOPPY_IRQ)); + floppy_send(head << 2 | drive); + + while (!get_irq(FLOPPY_IRQ)) { + clock_step(1000000000LL / 50); + } + + st0 =3D floppy_recv(); + st1 =3D floppy_recv(); + floppy_recv(); /* ST2 */ + floppy_recv(); /* cylinder */ + floppy_recv(); /* head */ + floppy_recv(); /* sector */ + g_assert(get_irq(FLOPPY_IRQ)); + floppy_recv(); /* sector size */ + g_assert(!get_irq(FLOPPY_IRQ)); + + g_assert_cmpint(st0 & ST0_DS_MASK, =3D=3D, drive); + g_assert_cmpint(st0 & ST0_IC_MASK, =3D=3D, ST0_IC_ABNTERM); + g_assert_cmpint(st1 & ST1_MA, =3D=3D, ST1_MA); +} + static void test_read_no_dma_1(void) { uint8_t ret; @@ -656,6 +698,11 @@ static void test_cve_2021_3507(void) qtest_quit(s); } =20 +#define MACHINE_ONE_DRIVE "-machine pc -device floppy,id=3Dfloppy0" +#define MACHINE_TWO_DRIVES \ + "-machine pc -device floppy,id=3Dfloppy0,unit=3D0" \ + " -device floppy,id=3Dfloppy1,unit=3D1" + /* * Each test gets its own QEMU instance, so that none of them depends on t= he * state another one left behind. Without this, several tests only pass in @@ -667,35 +714,39 @@ static void test_cve_2021_3507(void) typedef struct { const char *path; void (*fn)(void); + const char *args; } FDCTest; =20 static const FDCTest fdc_tests[] =3D { - { "/fdc/cmos", test_cmos }, - { "/fdc/no_media_on_start", test_no_media_on_start }, - { "/fdc/read_without_media", test_read_without_media }, - { "/fdc/media_change", test_media_change }, - { "/fdc/sense_interrupt", test_sense_interrupt }, - { "/fdc/relative_seek", test_relative_seek }, - { "/fdc/read_id", test_read_id }, - { "/fdc/read_id_no_media", test_read_id_no_media }, - { "/fdc/verify", test_verify }, - { "/fdc/media_insert", test_media_insert }, - { "/fdc/read_no_dma_1", test_read_no_dma_1 }, - { "/fdc/read_no_dma_18", test_read_no_dma_18 }, - { "/fdc/read_no_dma_19", test_read_no_dma_19 }, - { "/fdc/fuzz-registers", fuzz_registers }, + { "/fdc/cmos", test_cmos, MACHINE_ONE_DRIVE = }, + { "/fdc/no_media_on_start", test_no_media_on_start, MACHINE_ONE_DRIVE = }, + { "/fdc/read_without_media", test_read_without_media, MACHINE_ONE_DRIV= E }, + { "/fdc/media_change", test_media_change, MACHINE_ONE_DRIVE = }, + { "/fdc/sense_interrupt", test_sense_interrupt, MACHINE_ONE_DRIVE = }, + { "/fdc/relative_seek", test_relative_seek, MACHINE_ONE_DRIVE = }, + { "/fdc/read_id", test_read_id, MACHINE_ONE_DRIVE = }, + { "/fdc/read_id_no_media", test_read_id_no_media, MACHINE_ONE_DRIVE = }, + { "/fdc/read_id_other_drive", test_read_id_other_drive, + MACHINE_TWO_DRIVES= }, + { "/fdc/verify", test_verify, MACHINE_ONE_DRIVE = }, + { "/fdc/media_insert", test_media_insert, MACHINE_ONE_DRIVE = }, + { "/fdc/read_no_dma_1", test_read_no_dma_1, MACHINE_ONE_DRIVE = }, + { "/fdc/read_no_dma_18", test_read_no_dma_18, MACHINE_ONE_DRIVE = }, + { "/fdc/read_no_dma_19", test_read_no_dma_19, MACHINE_ONE_DRIVE = }, + { "/fdc/fuzz-registers", fuzz_registers, MACHINE_ONE_DRIVE = }, }; =20 static void run_isolated(const void *data) { const FDCTest *test =3D data; =20 + /* Every command line in fdc_tests[] names the pc machine */ if (!qtest_has_machine("pc")) { g_test_skip("Machine 'pc' is not available"); return; } =20 - qtest_start("-machine pc -device floppy,id=3Dfloppy0"); + qtest_start(test->args); qtest_irq_intercept_in(global_qtest, "ioapic"); =20 test->fn(); --=20 2.53.0 From nobody Sat Sep 26 20:51:04 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=1789080083; cv=none; d=zohomail.com; s=zohoarc; b=GJj5IebaK4UP92BK/9DMAZZ3u/LooQoqqF2Qz7hYaktLk24EHuEhJGMP3tuqCYDjS8Tgc3wrGjTVODIZt3tIMN7DXJ6s3IPI20JMpRMjBs2idMgMWPCRqF4Lf3+p8zcbM5hr9mGc775EdSGaBuE+y3ICfhr2hNRCVwc5vcImjro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789080083; 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=GQ9VeugiW+rPuTWWJ01AvhVzMaKeZUhNf2XmHpNRQyQ=; b=iQ9HFM9jMO02VYrmiIDivy3YEt4Y9by9STbbQneseF03+cKsI2xBPr4CgS7L03HyKwcZGSpuIHjop0J0jLUFfbNoKdsVIjVwCuoLnsoSWFTAaFPH6I5hwmq00xYViqZThSdUYqzGc3J8rOnAqgBO1NVoJXz7WsBvSaxy1zbciWM= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789080083776845.7741485777791; Thu, 10 Sep 2026 15:41:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4nJJ-00079P-99; Thu, 10 Sep 2026 18:32:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x4lOx-0003vQ-Sf for qemu-devel@nongnu.org; Thu, 10 Sep 2026 16:30:01 -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 1x4lOM-00016V-Ab for qemu-devel@nongnu.org; Thu, 10 Sep 2026 16:29:12 -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 C78A021EC8; Thu, 10 Sep 2026 20:26:11 +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 C362E13A5C; Thu, 10 Sep 2026 20:26:10 +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 MN3hJGISo2pJPQAAD6G6ig (envelope-from ); Thu, 10 Sep 2026 20:26:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789071975; 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=GQ9VeugiW+rPuTWWJ01AvhVzMaKeZUhNf2XmHpNRQyQ=; b=Jyxpc3qf7+2vN451rIZ1waVTqTmZkZwOvwegpj5WUp278QSAokf5e7vvEIxLSeF020tebw Qaqyscj+SBD1JvP0NeBMfY9BkyqPx6cFpqK+gtuIhkAvIk3XHuY/mOlTjlTpcgNVD91q87 RwqX4FAI/16vWMEagtaHOG9GjslzYNQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789071975; 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=GQ9VeugiW+rPuTWWJ01AvhVzMaKeZUhNf2XmHpNRQyQ=; b=gqbzGKBtXKYq8F6X+OyQdbg0C5QJ8gxa6O7wk56+kTb5GY2ez+R8/sgKjkymUtU/wh42q1 d+tJNaWvkWSsMHAw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=FEmXpC2B; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=d5q+UNo1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789071971; 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=GQ9VeugiW+rPuTWWJ01AvhVzMaKeZUhNf2XmHpNRQyQ=; b=FEmXpC2BIqXYKXJ3MlrizlT9jo6IqLOI1A1YCEITUD28ATf/okPjVTpJdi0UIzLfNDs3RD ZJJTNwIULvzBs6WyYAhydfCONcvOhRKTriKKQPGvU5Bw/qTesrls0VlRQ0YzGj9JbWuG9G wERb7n7DSumAqCUFqnQ81H3aAFAz+as= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789071971; 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=GQ9VeugiW+rPuTWWJ01AvhVzMaKeZUhNf2XmHpNRQyQ=; b=d5q+UNo1UiYan0l2x1Y5+xCTRQEMkID8XVye82eBZZeQ2ZNk/aqMLOqLRNge4mcJpUNxGs oEMGcRHqPzoe72BQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: "Denis V. Lunev" Subject: [PULL 4/7] ahci: Fix leak of IRQState Date: Thu, 10 Sep 2026 17:25:56 -0300 Message-ID: <20260910202559.916866-5-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260910202559.916866-1-farosas@suse.de> References: <20260910202559.916866-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: C78A021EC8 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)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,openvz.org:email,suse.de:dkim,suse.de:email,suse.de:mid]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Score: -3.01 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=lists1p.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) (identity @suse.de) X-ZM-MESSAGEID: 1789080087058158500 Content-Type: text/plain; charset="utf-8" ASAN spotted an indirect leak in ahci-test: Indirect leak of 576 byte(s) in 6 object(s) allocated from: #0 0x556112a08ca0 in malloc #1 0x7f21591e595d in g_malloc #2 0x7f21591ffe38 in g_slice_alloc #3 0x7f21591c988d in g_hash_table_new_full #4 0x556114d756f1 in object_initialize_with_type ../qom/object.c:506:23 #5 0x556114d77590 in object_new_with_type ../qom/object.c:706:5 #6 0x556114d777e8 in object_new ../qom/object.c:722:12 #7 0x556114d6d2be in qemu_allocate_irq ../hw/core/irq.c:94:25 #8 0x556114d6d1bc in qemu_extend_irqs ../hw/core/irq.c:82:16 #9 0x556114d6d329 in qemu_allocate_irqs ../hw/core/irq.c:89:12 #10 0x5561135da9bd in ahci_realize ../hw/ide/ahci.c:1644:12 #11 0x55611360156a in pci_ich9_ahci_realize ../hw/ide/ich.c:132:5 Although ahci_realize() frees the return of qemu_allocate_irqs() right away, the individual IRQStates are still left around. Issue qemu_free_irq() at ahci_uninit(). Reviewed-by: Denis V. Lunev Signed-off-by: Fabiano Rosas --- hw/ide/ahci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 6b04762c4a..86f6297dc9 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1688,6 +1688,7 @@ void ahci_uninit(AHCIState *s) } ide_exit(ide_state); } + qemu_free_irq(ad->port.irq); object_unparent(OBJECT(&ad->port)); } =20 --=20 2.53.0 From nobody Sat Sep 26 20:51:04 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=1789080341; cv=none; d=zohomail.com; s=zohoarc; b=Wz6fffWkAEVtgXbqTGAK2UNcvhi6Lkz8dWnrX+Mhw1liIQeU8tlwufuD/9NlccQu+hJSDsq6bmk89lbF0D8zDpZJVb7hQ648o4uq6WHRowVgnfcgL8a6gJvg6PaKZxU7m/B+pY0nUToDw0eqrohX9G0+dUIoDECEYkqn4DPgf7w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789080341; 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=i81n+GnYIxgR2D7wkfxfD6rDpyiLWPJwk+0xmQ4/zbo=; b=FvzTeKbvnVwYMsKeiak+6THuUg9fgdHyzj1LYH55m5jD2xuy/Wp/qEQUfwq0ZUANLs6TFwXz4GWGGu1MVnuq2y2XMzRxh1LmZNCgm4V2K1QrUF5+V8zMbRB0eO1JJInH71xI7awtXLO6StBPG4YlF3rNRAJd2W0B915sNTpA1TI= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789080341330308.2183421923381; Thu, 10 Sep 2026 15:45:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4nTr-0001sL-0Q; Thu, 10 Sep 2026 18:43:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x4lMk-0003KK-VS for qemu-devel@nongnu.org; Thu, 10 Sep 2026 16:27:44 -0400 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x4lMb-00018C-HU for qemu-devel@nongnu.org; Thu, 10 Sep 2026 16:27: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-out2.suse.de (Postfix) with ESMTPS id 5B0E41FEE6; Thu, 10 Sep 2026 20:26:15 +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 DACA813A5D; Thu, 10 Sep 2026 20:26:11 +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 eESWKmMSo2pJPQAAD6G6ig (envelope-from ); Thu, 10 Sep 2026 20:26:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789071979; 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=i81n+GnYIxgR2D7wkfxfD6rDpyiLWPJwk+0xmQ4/zbo=; b=W4X0EdgxMDHW+cuq3ZLN4J10UQ9RJZr0K/5xkuttOtRkFGy8oWnLkXOgunBLf630dsTD4Z +PxJAatnhPX44GEMzlXxTTmCpaq4HB6xjVIFeXYLkmzjf+VUKEd4eD8v+Eje0qHgjPcqn7 VUcrak2o2WDaLeMp8QlngJOjuwqzusY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789071979; 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=i81n+GnYIxgR2D7wkfxfD6rDpyiLWPJwk+0xmQ4/zbo=; b=885n9/h+w7jcyrdJ41eSiOal6Z9G+kZddG3y21NawzLqIdCGTs9VwuKf/+ZmroL/IAABFY 9Ij5Ho3zyXIxI2DQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789071975; 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=i81n+GnYIxgR2D7wkfxfD6rDpyiLWPJwk+0xmQ4/zbo=; b=DeWyp0SUwE5yT5tgfc7u80vaKVK6wYiZiDes6jOeXAm2JPhnngyYagHgcSrZRgb9g05ciZ OaL+3Wj3i1hcpy6I5o4CZkwKp4VQTYrSQTrIvaYc0Mj66UfFX3+i7JSJ0kUg9KXHwSt71f bRffh1PO1VVlvnemMmp4DeWq+nOvYsc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789071975; 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=i81n+GnYIxgR2D7wkfxfD6rDpyiLWPJwk+0xmQ4/zbo=; b=ttgprqApxsP2WhkEI/YFZAG74ANI/Ftr9omKNaB5R8ddq+MrVVsMSufnNJxY/YtG0wo4ds U0CACmrLG6QPThDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Peter Xu Subject: [PULL 5/7] migration: Drop iochannel reference during snapshot setup Date: Thu, 10 Sep 2026 17:25:57 -0300 Message-ID: <20260910202559.916866-6-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260910202559.916866-1-farosas@suse.de> References: <20260910202559.916866-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)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.997]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; 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]; 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)[suse.de:email, suse.de:mid, imap1.dmz-prg2.suse.org:helo] 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.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) (identity @suse.de) X-ZM-MESSAGEID: 1789080345455158500 During migration there are usually two references to the iochannel, one from the channel creation itself and another from the ownership transfer into QEMUFile. - The reference from the QEMUFile is decremented at qemu_fclose. - The original reference is decremented at migration_connect_outgoing() for regular migration and not at all for snapshots. The ide-test has recently added migration support and ASAN has flagged: Indirect leak of 32 byte(s) in 1 object(s) allocated from: #0 0x55ca12aac0b9 in realloc #1 0x7fd97d7e5a05 in g_realloc #3 0x7fd97d7c98c6 in g_hash_table_new_full #4 0x55ca14e186f1 in object_initialize_with_type ../qom/object.c:506:23 #5 0x55ca14e1a590 in object_new_with_type ../qom/object.c:706:5 #6 0x55ca14e1a7e8 in object_new ../qom/object.c:722:12 #7 0x55ca12de896f in qio_channel_block_new ../migration/channel-block.c= :32:29 #8 0x55ca12ec8f2d in qemu_fopen_bdrv ../migration/savevm.c:172:49 #9 0x55ca12ec8b42 in save_snapshot ../migration/savevm.c:3375:9 #10 0x55ca12ee18e3 in hmp_savevm ../migration/migration-hmp-cmds.c:497:5 Change qemu_fopen_bdrv() to drop the original reference once the QEMUFile has taken over the object. The xen code already does the same. Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/savevm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 5b0e89ca7c..8d4bdc28ab 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -168,11 +168,16 @@ static bool qemu_loadvm_thread_pool_wait(MigrationSta= te *s, =20 static QEMUFile *qemu_fopen_bdrv(BlockDriverState *bs, int is_writable) { + QIOChannel *ioc =3D QIO_CHANNEL(qio_channel_block_new(bs)); + QEMUFile *f; + if (is_writable) { - return qemu_file_new_output(QIO_CHANNEL(qio_channel_block_new(bs))= ); + f =3D qemu_file_new_output(ioc); } else { - return qemu_file_new_input(QIO_CHANNEL(qio_channel_block_new(bs))); + f =3D qemu_file_new_input(ioc); } + object_unref(ioc); + return f; } =20 =20 --=20 2.53.0 From nobody Sat Sep 26 20:51:04 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=1789081309; cv=none; d=zohomail.com; s=zohoarc; b=BW1tdzUcO7yleOfLzgTKYUgzd69lS8SzDu76mKOBc57dl2bwpdDSvoUfR/+Y4ofe4zb/d+/SCTP+xJE6IizJkEUKZdXXlyxZ3IxAskzqV3urKozi/phV6c42wffouNavIqElRsIuohnged6Byf1BfOjDsbuewrSlwXqWlc0VPDU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789081309; 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=e5CQK+0NTx+BlLMQmomgu0zA1iD/w1c1y2gfdfJAoxc=; b=Ln/lbXwRfapqSenv2qHeI/Suim6402zsU4hA1YhJ9wbYa+4JdFX20WLRpjAVI3V+6vHICLzLoK+ORGZQB454weXUqRJE6b4KTXuPmN5OVQv8Fc+ADMHM29Es7V2CTDaq+d6kAHiqEfBCQzzXZ+cbHN/rmSIWKMZzAQOjvvDwEpE= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTP id 1789081309055853.2096173619509; Thu, 10 Sep 2026 16:01:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4niN-0005Ur-SO; Thu, 10 Sep 2026 18:58:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x4lML-00038j-2e for qemu-devel@nongnu.org; Thu, 10 Sep 2026 16:27:29 -0400 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x4lMA-00018S-FH for qemu-devel@nongnu.org; Thu, 10 Sep 2026 16:26:56 -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-out2.suse.de (Postfix) with ESMTPS id 7CB871FEEB; Thu, 10 Sep 2026 20:26:15 +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 2A5BE13A5E; Thu, 10 Sep 2026 20:26:12 +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 4HsdO2QSo2pJPQAAD6G6ig (envelope-from ); Thu, 10 Sep 2026 20:26:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789071979; 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=e5CQK+0NTx+BlLMQmomgu0zA1iD/w1c1y2gfdfJAoxc=; b=wrHjFBM++IR10vCBt8Zu80zqteLh9xsZquxESOaq/1erPYo5Ss5MJUy2RbBArc/osL44+k eBqKAJcaDyGzenD98e95mCPG0sfJjhYakR821QLuj8kK+H+CdxsMQnrMQ6FzZHN1aTBVGi JKx6BFF+Twe0tLo8NKMPI18A3K57q8Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789071979; 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=e5CQK+0NTx+BlLMQmomgu0zA1iD/w1c1y2gfdfJAoxc=; b=RjkBsUSv3Hv63BX1jUOR9261qPGdaZJey02O8o94ya93yLArhbA/pg+VMhrUNtLIU+zCIG gJIk+rCHLWIIgOAA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=kfdGPmLf; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=9Evuf27y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789071975; 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=e5CQK+0NTx+BlLMQmomgu0zA1iD/w1c1y2gfdfJAoxc=; b=kfdGPmLfn6FJxJaglgpSTILMPlpKIiEXzip1CuZOkSHnGU+Kry/eoBOdLY5nA1LYHwFQeF p9ifIGWjseGArRZZn9s8rd2Mtis+VJsMH0FWdJfsjWWDmV0bSz0yV8M/JrKMgUsskxl5kI dwf0VZIHlje/l96PcD/4LwAhpmj9XKc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789071975; 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=e5CQK+0NTx+BlLMQmomgu0zA1iD/w1c1y2gfdfJAoxc=; b=9Evuf27y41B3iiWDadXY+3RA3lQEl1xgxRn2AU+yXsqc9brxfrf7AOT8QH92ZJ8L7WnwiZ du0m6RRuYiAT1vDQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu Subject: [PULL 6/7] migration: Free the JSON writer during snapshots Date: Thu, 10 Sep 2026 17:25:58 -0300 Message-ID: <20260910202559.916866-7-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260910202559.916866-1-farosas@suse.de> References: <20260910202559.916866-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.01 X-Rspamd-Queue-Id: 7CB871FEEB X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 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)[]; 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)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.de:email,suse.de:mid]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.de:+] 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=lists1p.gnu.org; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.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) (identity @suse.de) X-ZM-MESSAGEID: 1789081309819158500 Content-Type: text/plain; charset="utf-8" The JSON writer is created at migrate_init() and freed at migration_cleanup(). The latter is not called for snapshots. Add a call to migration_cleanup_json_writer() to make sure it doesn't leak: Indirect leak of 24 byte(s) in 1 object(s) allocated from: #0 0x55ca12aabca0 in malloc #1 0x7fd97d7e595d in g_malloc #2 0x7fd97d7ffe38 in g_slice_alloc #3 0x7fd97d8042e2 in g_string_sized_new #4 0x55ca1571dd6b in json_writer_new ../qobject/json-writer.c:36:24 #5 0x55ca12e0de56 in migrate_init ../migration/migration.c:1718:21 #6 0x55ca12ec8fe6 in qemu_savevm_state ../migration/savevm.c:1921:11 #7 0x55ca12ec8b93 in save_snapshot ../migration/savevm.c:3380:11 Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 2 +- migration/migration.h | 1 + migration/savevm.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index b413d28622..d0b864a760 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1330,7 +1330,7 @@ void migrate_set_state(MigrationStatus *state, Migrat= ionStatus old_state, } } =20 -static void migration_cleanup_json_writer(MigrationState *s) +void migration_cleanup_json_writer(MigrationState *s) { g_clear_pointer(&s->vmdesc, json_writer_free); } diff --git a/migration/migration.h b/migration/migration.h index e47ff4e3d1..683bc7bdd5 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -633,4 +633,5 @@ void migration_bitmap_sync_precopy(bool last_stage); void dirty_bitmap_mig_init(void); bool should_send_vmdesc(void); =20 +void migration_cleanup_json_writer(MigrationState *s); #endif diff --git a/migration/savevm.c b/migration/savevm.c index 8d4bdc28ab..4b590ea672 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1952,6 +1952,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **err= p) } cleanup: qemu_savevm_state_cleanup(); + migration_cleanup_json_writer(ms); =20 if (ret !=3D 0) { status =3D MIGRATION_STATUS_FAILED; --=20 2.53.0 From nobody Sat Sep 26 20:51:04 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=1789082367; cv=none; d=zohomail.com; s=zohoarc; b=NJ54+3SkoP8bb6D8qL4Ef2/QmZgYW+vdjW1JhzlOrNM6TIMbtzVM3wbxPIcNiksZD6Z1XFWBcGs6xuEgv6S8ZRtKO3i9a/xiCsp+0QzuATmnMW9s8e/nMOQGN1bt6/eYJOuxCcDlmm1QM+ZNDjFVZJmCAvmXoybj+CggYMuDZ5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789082367; 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=vxJGuhRlX9wkUvThjA2Y5nMv5TNuGWBfekFjx71R4pw=; b=TAS5s0ycnnPqgVf8awyCOKWc4ylq+AwZd+Nh1MzrWEOaB9x9R0xEVG8KTHu6LPbwuB/kuS5LOV01TJCpg6Fjcrw7uBxklnQPemUwWKCmUPLg/cRzWdOR6UumCxFb+6ZBv/fhboHeJebnXhswBPrmRdjfIcJ7sQO3wwQaAWuWSOQ= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1789082367036838.3630952066889; Thu, 10 Sep 2026 16:19:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x4nWG-0002Qv-8A; Thu, 10 Sep 2026 18:45:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x4lNI-0003Pc-35 for qemu-devel@nongnu.org; Thu, 10 Sep 2026 16:28:11 -0400 Received: from smtp-out2.suse.de ([195.135.223.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1x4lN3-00018h-Gt for qemu-devel@nongnu.org; Thu, 10 Sep 2026 16:27:52 -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-out2.suse.de (Postfix) with ESMTPS id AA8CD1FEEC; Thu, 10 Sep 2026 20:26:16 +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 4162B13A5F; Thu, 10 Sep 2026 20:26:14 +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 OGUcBWYSo2pJPQAAD6G6ig (envelope-from ); Thu, 10 Sep 2026 20:26:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789071980; 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=vxJGuhRlX9wkUvThjA2Y5nMv5TNuGWBfekFjx71R4pw=; b=bcsh7DFoEtU9tihmgvI6tMuk+NYajLrM6JjRRMV4wOrhywbhqkxDBBtpZgJLS1NLZgeXxj IPo/7u7XPi304cT/ob/3dG2LfSHLhjcf4iX5bXjLvf5zznLCBAUmTxdRqwJthh6SE8FSGZ n/kp1y7/W0AoQ3dA71HHpUO8ak3AbMQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789071980; 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=vxJGuhRlX9wkUvThjA2Y5nMv5TNuGWBfekFjx71R4pw=; b=egX6q7bFpAme3R26Weu/1iiXgyvNeeXbjsBA6mSE68hzeM0Bn+qbzE5sueryQCTeM/o4Cc QZnU/v2mYm8YMcCg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1789071976; 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=vxJGuhRlX9wkUvThjA2Y5nMv5TNuGWBfekFjx71R4pw=; b=gHeZ/yVj7skqIm0PAbP+i7Hqsx+ROofC8wvxmDXPoOqPoDEUQYISS+ehFlfEq38xt0nC/f aYw7l+0DU7c+gdRIkHnPOZweYnzpdw3czCpJU91wPhmcNdXqXZ2+QNtT61zGIIEpGeClGq U9FZVLv0FrHdLmKndwPiQNFwGKTvtaM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1789071976; 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=vxJGuhRlX9wkUvThjA2Y5nMv5TNuGWBfekFjx71R4pw=; b=mMxjO4pCdZc8AyT/MH3pNwol1SLToTFMhbvcNhnQdTTur/Zm2FR/HF0VMv5Lc+vxbgQMuB tFmhHONgQl/c2TCw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: "Denis V. Lunev" Subject: [PULL 7/7] tests/qtest/ahci: fix a racy deadlock in the engine stop test Date: Thu, 10 Sep 2026 17:25:59 -0300 Message-ID: <20260910202559.916866-8-farosas@suse.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260910202559.916866-1-farosas@suse.de> References: <20260910202559.916866-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%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.997]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; 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)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid,openvz.org:email,imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; 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=lists1p.gnu.org; Received-SPF: pass client-ip=195.135.223.131; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, 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: 1789082369056158500 Content-Type: text/plain; charset="utf-8" From: "Denis V. Lunev" test_write_engine_stop_in_flight() resumes the suspended backend write and goes straight on to restart the command engine and read the second sector back. Whether the write has retired by then is a race. While it is still outstanding the drive is busy, and handle_cmd() drops a command that arrives in that state instead of queueing it. Nothing retries the drop, so the PxCI slot stays set and no D2H FIS is posted. ahci_command_wait() polls both with no timeout, so the test deadlocks until the harness kills it. Drain the port before issuing the read, so the abandoned write has retired and the engine is idle. Host load stretches the gap between the resume and the write completing, which is why the deadlock only shows up on a loaded machine. Fixes: d05ae87e7a6a ("tests/qtest/ahci: regression test for a PIO write vs.= engine stop") Signed-off-by: Denis V. Lunev Reviewed-by: Fabiano Rosas Signed-off-by: Fabiano Rosas --- tests/qtest/ahci-test.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c index eb8d239997..c49aa61862 100644 --- a/tests/qtest/ahci-test.c +++ b/tests/qtest/ahci-test.c @@ -1912,6 +1912,12 @@ static void test_write_engine_stop_in_flight(void) =20 qtest_qemu_io(ahci->parent->qts, "drive0", "resume wr"); =20 + /* + * Retire the abandoned write. handle_cmd() drops a command that arriv= es + * while the drive is still busy and nothing retries it. + */ + g_free(qtest_hmp(ahci->parent->qts, "qemu-io drive0 \"aio_flush\"")); + /* Round-trip through the device to confirm qemu is still alive. */ ahci_px_rreg(ahci, port, AHCI_PX_TFD); =20 --=20 2.53.0