From nobody Mon Feb 9 00:46:14 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615929451; cv=none; d=zohomail.com; s=zohoarc; b=J8wNdcFGYm1fFa3RctrIUVdSLVoIkOmJbtCfS4tbEG63GHTOvPellBGtHv6Bc6TilfJ3ZjFBYY/684fizMP8teHeBjeEv71wx6RrfFiut3XB7c0/xm5Ds4RqrVq0eND8hQGr9kCKAIoITd3DZPM7oY2RKmk+ZWDQYpwD7/7Rp6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615929451; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MCzAiseVR70Wf4B59DnA32hHCp8wyen0IGUuKqC612k=; b=fC1EsqlofDxsOisizJ7xCgT0t0WiV5vQvfpOrHhtYPml/IzdRui9C2BpCMpiMsSHC1Zz+oVNvxKOQAvr4S5uPkLDycx/cd7msJXPNfekku+sOMvUjiX9SyPpgCC10yZF1egeWqft5kQiBYoBvZtt92jZhTaDrmlkU2eCyXjA2hE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615929451447493.55053136083563; Tue, 16 Mar 2021 14:17:31 -0700 (PDT) Received: from localhost ([::1]:40512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMH4E-0007GD-5z for importer@patchew.org; Tue, 16 Mar 2021 17:17:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2W-0005Nk-Bm for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45080) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMH2S-0003TI-E8 for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:44 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-365-_EzdpzyoMyWndVhJ3Gb2vw-1; Tue, 16 Mar 2021 17:15:36 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 126EA107ACCD for ; Tue, 16 Mar 2021 21:15:35 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id B43561378D; Tue, 16 Mar 2021 21:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929339; h=from:from:reply-to:subject:subject: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=MCzAiseVR70Wf4B59DnA32hHCp8wyen0IGUuKqC612k=; b=S0elZ8TxbaQSZFC0oaYkN0dAf/Iqi6iKIwZogD1+qTGUMSF2bkcoS+XhGgXfxoq1cJ2p4L vK3XshB+LuJtIxiDWuUD40nug7MKbBAqq+u3OgIM90IkXduxX9utJOR0UIKwtt1qXMpqtn P8UCLlOCsfGJjk6yE+0aCWHlNPSNKzs= X-MC-Unique: _EzdpzyoMyWndVhJ3Gb2vw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 01/16] tests/qtest: Only run fuzz-megasas-test if megasas device is available Date: Tue, 16 Mar 2021 17:15:16 -0400 Message-Id: <20210316211531.1649909-2-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 This test fails when QEMU is built without the megasas device, restrict it to its availability. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini --- MAINTAINERS | 1 + tests/qtest/fuzz-megasas-test.c | 49 +++++++++++++++++++++++++++++++++ tests/qtest/fuzz-test.c | 25 ----------------- tests/qtest/meson.build | 4 ++- 4 files changed, 53 insertions(+), 26 deletions(-) create mode 100644 tests/qtest/fuzz-megasas-test.c diff --git a/MAINTAINERS b/MAINTAINERS index 5ca3c9f851..0f560d1b91 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1969,6 +1969,7 @@ S: Supported F: hw/scsi/megasas.c F: hw/scsi/mfi.h F: tests/qtest/megasas-test.c +F: tests/qtest/fuzz-megasas-test.c =20 Network packet abstractions M: Dmitry Fleytman diff --git a/tests/qtest/fuzz-megasas-test.c b/tests/qtest/fuzz-megasas-tes= t.c new file mode 100644 index 0000000000..940a76bf25 --- /dev/null +++ b/tests/qtest/fuzz-megasas-test.c @@ -0,0 +1,49 @@ +/* + * QTest fuzzer-generated testcase for megasas device + * + * Copyright (c) 2020 Li Qiang + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" + +#include "libqos/libqtest.h" + +/* + * This used to trigger the assert in scsi_dma_complete + * https://bugs.launchpad.net/qemu/+bug/1878263 + */ +static void test_lp1878263_megasas_zero_iov_cnt(void) +{ + QTestState *s; + + s =3D qtest_init("-nographic -monitor none -serial none " + "-M q35 -device megasas -device scsi-cd,drive=3Dnull0 " + "-blockdev driver=3Dnull-co,read-zeroes=3Don,node-name= =3Dnull0"); + qtest_outl(s, 0xcf8, 0x80001818); + qtest_outl(s, 0xcfc, 0xc101); + qtest_outl(s, 0xcf8, 0x8000181c); + qtest_outl(s, 0xcf8, 0x80001804); + qtest_outw(s, 0xcfc, 0x7); + qtest_outl(s, 0xcf8, 0x8000186a); + qtest_writeb(s, 0x14, 0xfe); + qtest_writeb(s, 0x0, 0x02); + qtest_outb(s, 0xc1c0, 0x17); + qtest_quit(s); +} + +int main(int argc, char **argv) +{ + const char *arch =3D qtest_get_arch(); + + g_test_init(&argc, &argv, NULL); + + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + qtest_add_func("fuzz/test_lp1878263_megasas_zero_iov_cnt", + test_lp1878263_megasas_zero_iov_cnt); + } + + return g_test_run(); +} diff --git a/tests/qtest/fuzz-test.c b/tests/qtest/fuzz-test.c index 6f161c93be..631feaf0eb 100644 --- a/tests/qtest/fuzz-test.c +++ b/tests/qtest/fuzz-test.c @@ -11,29 +11,6 @@ =20 #include "libqos/libqtest.h" =20 -/* - * This used to trigger the assert in scsi_dma_complete - * https://bugs.launchpad.net/qemu/+bug/1878263 - */ -static void test_lp1878263_megasas_zero_iov_cnt(void) -{ - QTestState *s; - - s =3D qtest_init("-nographic -monitor none -serial none " - "-M q35 -device megasas -device scsi-cd,drive=3Dnull0 " - "-blockdev driver=3Dnull-co,read-zeroes=3Don,node-name= =3Dnull0"); - qtest_outl(s, 0xcf8, 0x80001818); - qtest_outl(s, 0xcfc, 0xc101); - qtest_outl(s, 0xcf8, 0x8000181c); - qtest_outl(s, 0xcf8, 0x80001804); - qtest_outw(s, 0xcfc, 0x7); - qtest_outl(s, 0xcf8, 0x8000186a); - qtest_writeb(s, 0x14, 0xfe); - qtest_writeb(s, 0x0, 0x02); - qtest_outb(s, 0xc1c0, 0x17); - qtest_quit(s); -} - static void test_lp1878642_pci_bus_get_irq_level_assert(void) { QTestState *s; @@ -103,8 +80,6 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); =20 if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { - qtest_add_func("fuzz/test_lp1878263_megasas_zero_iov_cnt", - test_lp1878263_megasas_zero_iov_cnt); qtest_add_func("fuzz/test_lp1878642_pci_bus_get_irq_level_assert", test_lp1878642_pci_bus_get_irq_level_assert); qtest_add_func("fuzz/test_mmio_oob_from_memory_region_cache", diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 66ee9fbf45..536991cdb8 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -17,7 +17,9 @@ slow_qtests =3D { 'test-hmp' : 120, } =20 -qtests_generic =3D [ +qtests_generic =3D \ + (config_all_devices.has_key('CONFIG_MEGASAS_SCSI_PCI') ? ['fuzz-megasas-= test'] : []) + \ + [ 'cdrom-test', 'device-introspect-test', 'machine-none-test', --=20 2.26.2 From nobody Mon Feb 9 00:46:14 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615929572; cv=none; d=zohomail.com; s=zohoarc; b=HNFPExHpTHrwMCj/YjkwVst4OuIjwzpaji35+PR9IPTJhyT7SRwgN4EO7Q2+LdqxFQN7w/k6ufYEd2Ks+x3VNSMX0mzQZbd3il2Il/av0jdbwOLRs2/gem89mRbNd1PLlHqFoKcoFsf/fWUPVGeKDytdAQ7Io4Xl6isovW1c9RI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615929572; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jXR1UDOdHdgAjRNgCrwYIvG60Cws8IHe3oGSa2AzoTM=; b=iHAgUCs8ooHLLX8rHd9SAMSwI1bHtZbivHAf76sb51gza42XKVocwf4xyEsi3AYqUBIXuydw/Z7Ju44POVcCnl/enaLo6V6XgAw4ZjsbvkGQlcuavMcMPl0oXVba5111TYZ4CfNWuzO/pp1PTZZSbddDCuBahV+xWfstAeRJ81E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615929572641112.6814596977473; Tue, 16 Mar 2021 14:19:32 -0700 (PDT) Received: from localhost ([::1]:48744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMH6B-0002EZ-KH for importer@patchew.org; Tue, 16 Mar 2021 17:19:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2c-0005T1-Lq for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:49855) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMH2W-0003Ux-6F for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:50 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-572-X-2xfEjdOZGQwNECaLk6sw-1; Tue, 16 Mar 2021 17:15:39 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A6C6D100C619 for ; Tue, 16 Mar 2021 21:15:38 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CD9B610AF; Tue, 16 Mar 2021 21:15:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929343; h=from:from:reply-to:subject:subject: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=jXR1UDOdHdgAjRNgCrwYIvG60Cws8IHe3oGSa2AzoTM=; b=BI+gxhgj8B3jk8BOLDLbpLhIle8qrP5zVTk5eNsDzQGCMUPQvqzW3vTZ3xXGmd2LHdFIM8 Pa8bBOFrRdJkoPN3eYVV52DTI78DfHt1RLZ24vJLV6BDaEswdpuodLX5wj/n2gWCB5jbkj 8/VKeK0vVKEIZYqgD1jm6XxiCeGV4e8= X-MC-Unique: X-2xfEjdOZGQwNECaLk6sw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 02/16] tests/qtest: Only run fuzz-virtio-scsi when virtio-scsi is available Date: Tue, 16 Mar 2021 17:15:17 -0400 Message-Id: <20210316211531.1649909-3-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S . Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 This test fails when QEMU is built without the virtio-scsi device, restrict it to its availability. Reviewed-by: Michael S. Tsirkin Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini --- MAINTAINERS | 1 + tests/qtest/fuzz-test.c | 51 -------------------- tests/qtest/fuzz-virtio-scsi-test.c | 75 +++++++++++++++++++++++++++++ tests/qtest/meson.build | 1 + 4 files changed, 77 insertions(+), 51 deletions(-) create mode 100644 tests/qtest/fuzz-virtio-scsi-test.c diff --git a/MAINTAINERS b/MAINTAINERS index 0f560d1b91..71c835bc1d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1759,6 +1759,7 @@ S: Supported F: include/hw/scsi/* F: hw/scsi/* F: tests/qtest/virtio-scsi-test.c +F: tests/qtest/fuzz-virtio-scsi-test.c T: git https://github.com/bonzini/qemu.git scsi-next =20 SSI diff --git a/tests/qtest/fuzz-test.c b/tests/qtest/fuzz-test.c index 631feaf0eb..00149abec7 100644 --- a/tests/qtest/fuzz-test.c +++ b/tests/qtest/fuzz-test.c @@ -24,55 +24,6 @@ static void test_lp1878642_pci_bus_get_irq_level_assert(= void) qtest_quit(s); } =20 -/* - * Here a MemoryRegionCache pointed to an MMIO region but had a - * larger size than the underlying region. - */ -static void test_mmio_oob_from_memory_region_cache(void) -{ - QTestState *s; - - s =3D qtest_init("-M pc-q35-5.2 -display none -m 512M " - "-device virtio-scsi,num_queues=3D8,addr=3D03.0 "); - - qtest_outl(s, 0xcf8, 0x80001811); - qtest_outb(s, 0xcfc, 0x6e); - qtest_outl(s, 0xcf8, 0x80001824); - qtest_outl(s, 0xcf8, 0x80001813); - qtest_outl(s, 0xcfc, 0xa080000); - qtest_outl(s, 0xcf8, 0x80001802); - qtest_outl(s, 0xcfc, 0x5a175a63); - qtest_outb(s, 0x6e08, 0x9e); - qtest_writeb(s, 0x9f003, 0xff); - qtest_writeb(s, 0x9f004, 0x01); - qtest_writeb(s, 0x9e012, 0x0e); - qtest_writeb(s, 0x9e01b, 0x0e); - qtest_writeb(s, 0x9f006, 0x01); - qtest_writeb(s, 0x9f008, 0x01); - qtest_writeb(s, 0x9f00a, 0x01); - qtest_writeb(s, 0x9f00c, 0x01); - qtest_writeb(s, 0x9f00e, 0x01); - qtest_writeb(s, 0x9f010, 0x01); - qtest_writeb(s, 0x9f012, 0x01); - qtest_writeb(s, 0x9f014, 0x01); - qtest_writeb(s, 0x9f016, 0x01); - qtest_writeb(s, 0x9f018, 0x01); - qtest_writeb(s, 0x9f01a, 0x01); - qtest_writeb(s, 0x9f01c, 0x01); - qtest_writeb(s, 0x9f01e, 0x01); - qtest_writeb(s, 0x9f020, 0x01); - qtest_writeb(s, 0x9f022, 0x01); - qtest_writeb(s, 0x9f024, 0x01); - qtest_writeb(s, 0x9f026, 0x01); - qtest_writeb(s, 0x9f028, 0x01); - qtest_writeb(s, 0x9f02a, 0x01); - qtest_writeb(s, 0x9f02c, 0x01); - qtest_writeb(s, 0x9f02e, 0x01); - qtest_writeb(s, 0x9f030, 0x01); - qtest_outb(s, 0x6e10, 0x00); - qtest_quit(s); -} - int main(int argc, char **argv) { const char *arch =3D qtest_get_arch(); @@ -82,8 +33,6 @@ int main(int argc, char **argv) if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { qtest_add_func("fuzz/test_lp1878642_pci_bus_get_irq_level_assert", test_lp1878642_pci_bus_get_irq_level_assert); - qtest_add_func("fuzz/test_mmio_oob_from_memory_region_cache", - test_mmio_oob_from_memory_region_cache); } =20 return g_test_run(); diff --git a/tests/qtest/fuzz-virtio-scsi-test.c b/tests/qtest/fuzz-virtio-= scsi-test.c new file mode 100644 index 0000000000..aaf6d10e18 --- /dev/null +++ b/tests/qtest/fuzz-virtio-scsi-test.c @@ -0,0 +1,75 @@ +/* + * QTest fuzzer-generated testcase for virtio-scsi device + * + * Copyright (c) 2020 Li Qiang + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" + +#include "libqos/libqtest.h" + +/* + * Here a MemoryRegionCache pointed to an MMIO region but had a + * larger size than the underlying region. + */ +static void test_mmio_oob_from_memory_region_cache(void) +{ + QTestState *s; + + s =3D qtest_init("-M pc-q35-5.2 -display none -m 512M " + "-device virtio-scsi,num_queues=3D8,addr=3D03.0 "); + + qtest_outl(s, 0xcf8, 0x80001811); + qtest_outb(s, 0xcfc, 0x6e); + qtest_outl(s, 0xcf8, 0x80001824); + qtest_outl(s, 0xcf8, 0x80001813); + qtest_outl(s, 0xcfc, 0xa080000); + qtest_outl(s, 0xcf8, 0x80001802); + qtest_outl(s, 0xcfc, 0x5a175a63); + qtest_outb(s, 0x6e08, 0x9e); + qtest_writeb(s, 0x9f003, 0xff); + qtest_writeb(s, 0x9f004, 0x01); + qtest_writeb(s, 0x9e012, 0x0e); + qtest_writeb(s, 0x9e01b, 0x0e); + qtest_writeb(s, 0x9f006, 0x01); + qtest_writeb(s, 0x9f008, 0x01); + qtest_writeb(s, 0x9f00a, 0x01); + qtest_writeb(s, 0x9f00c, 0x01); + qtest_writeb(s, 0x9f00e, 0x01); + qtest_writeb(s, 0x9f010, 0x01); + qtest_writeb(s, 0x9f012, 0x01); + qtest_writeb(s, 0x9f014, 0x01); + qtest_writeb(s, 0x9f016, 0x01); + qtest_writeb(s, 0x9f018, 0x01); + qtest_writeb(s, 0x9f01a, 0x01); + qtest_writeb(s, 0x9f01c, 0x01); + qtest_writeb(s, 0x9f01e, 0x01); + qtest_writeb(s, 0x9f020, 0x01); + qtest_writeb(s, 0x9f022, 0x01); + qtest_writeb(s, 0x9f024, 0x01); + qtest_writeb(s, 0x9f026, 0x01); + qtest_writeb(s, 0x9f028, 0x01); + qtest_writeb(s, 0x9f02a, 0x01); + qtest_writeb(s, 0x9f02c, 0x01); + qtest_writeb(s, 0x9f02e, 0x01); + qtest_writeb(s, 0x9f030, 0x01); + qtest_outb(s, 0x6e10, 0x00); + qtest_quit(s); +} + +int main(int argc, char **argv) +{ + const char *arch =3D qtest_get_arch(); + + g_test_init(&argc, &argv, NULL); + + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + qtest_add_func("fuzz/test_mmio_oob_from_memory_region_cache", + test_mmio_oob_from_memory_region_cache); + } + + return g_test_run(); +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 536991cdb8..6e871077c1 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -19,6 +19,7 @@ slow_qtests =3D { =20 qtests_generic =3D \ (config_all_devices.has_key('CONFIG_MEGASAS_SCSI_PCI') ? ['fuzz-megasas-= test'] : []) + \ + (config_all_devices.has_key('CONFIG_VIRTIO_SCSI') ? ['fuzz-virtio-scsi-t= est'] : []) + \ [ 'cdrom-test', 'device-introspect-test', --=20 2.26.2 From nobody Mon Feb 9 00:46:14 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615929450; cv=none; d=zohomail.com; s=zohoarc; b=OEJOH4MPXZtm+vWRKzRKHDXwraMt/f9ZLfvC93EIzIucD6pmc1h/VIkpa3uJldSZ7+jUyCRTvquvvzhn8UIw2OlD0Nb2L8IdgNkkYG33d9d1Wvkf03D1hmKTy5E5e5M6390bfwyLkiykowgPCCvcYhhCy2wibTUB9aIWB/ts+pU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615929450; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2fV8zAoWt9N1looJ2e92Y9LJtLWfBC0hWyl9AWfEchs=; b=C7HeBwtggO7ELmiXBTGt5njwS2y8ffNwF9O9Ir6tT6bjTL62F9F3SKr9M9rjiKTFh/m44y0b+5wqoiWrhrRNAb0pjLm0yhD4Hlbj+AwxNbH4C3MyqPPSiWsz78kuv7R0mEtg9xCNQqWhAcEzl60f+0UPw7XD23s0wLH2nTlSSYU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615929450834644.5894007511096; Tue, 16 Mar 2021 14:17:30 -0700 (PDT) Received: from localhost ([::1]:40520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMH4D-0007GM-Nf for importer@patchew.org; Tue, 16 Mar 2021 17:17:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2a-0005Qv-7C for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42837) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMH2W-0003TU-18 for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:46 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-418-PLMY7IerNHe1cncGNzWZgA-1; Tue, 16 Mar 2021 17:15:40 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1CED1192D785 for ; Tue, 16 Mar 2021 21:15:39 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0582610F0; Tue, 16 Mar 2021 21:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929341; h=from:from:reply-to:subject:subject: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=2fV8zAoWt9N1looJ2e92Y9LJtLWfBC0hWyl9AWfEchs=; b=NE250sJPeoHegO5fVb85sq1K1AEbxrhPjGKCNhOmKkuA47VnLeYxeOcWKWwDFsoVKY2MIK kZ2+6E/OP8v8+CiX54VtMxYAstTGHkM2gP9qI6ha2+jJFpovIyUXwLCk8XooOdnOxJ2KKY X1zJz7/5KpTwlLINHzjw4+T0gtPIAYQ= X-MC-Unique: PLMY7IerNHe1cncGNzWZgA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 03/16] MAINTAINERS: Cover fuzzer reproducer tests within 'Device Fuzzing' Date: Tue, 16 Mar 2021 17:15:18 -0400 Message-Id: <20210316211531.1649909-4-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 When we started to commit the fuzzer QTest reproducers to fuzz-test.c in commit d8dd1095019 ("qtest: add fuzz test case"), we forgot to add the corresponding MAINTAINERS entry. Do it now. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 71c835bc1d..0bd720a3d6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2634,6 +2634,7 @@ R: Stefan Hajnoczi R: Thomas Huth S: Maintained F: tests/qtest/fuzz/ +F: tests/qtest/fuzz-*test.c F: scripts/oss-fuzz/ F: docs/devel/fuzzing.rst =20 --=20 2.26.2 From nobody Mon Feb 9 00:46:14 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615929451; cv=none; d=zohomail.com; s=zohoarc; b=QDZfTRiNR/kg3YSIAfcldMfmX9Jjq2l8NTh1/AuACnlZY1fTbIaI34HAkROtKitwe6GqilGNAGRVsgb59PEeZJTFMMe9dYeblj8f4gS+WCAdGiNMveCHbERJWDgGO/ifNqN0p9EWWcapU52xKaAWdfSQTG8lBGWLPP6KLpmZFi4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615929451; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6lGNR1FXOQk6po1NGS81K9pZ4zMcV9JR4E7JUqbUu1c=; b=Mprb5AhLNDXIQr9ptCJ+QTFvcLaKmycjBUJ7VvTfNrsJ5t8aXmgZZ/qhzOZXaon+G2ieuyoxbQRTQH/nAvHxG0tBkYdkgBCR8oWZQxy+mclp47E/THR+dXy94o9FLBcWr2dh/SVO0yMfVZOQflvcccBK2eHAgPbDZBVbnoqyMGI= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615929451887735.1682297602854; Tue, 16 Mar 2021 14:17:31 -0700 (PDT) Received: from localhost ([::1]:40618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMH4E-0007Ig-Ra for importer@patchew.org; Tue, 16 Mar 2021 17:17:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2a-0005S2-Mu for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58759) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2W-0003V2-Km for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-249-0828CIP9NO6v3NqTtRewqg-1; Tue, 16 Mar 2021 17:15:41 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 858C2192D787; Tue, 16 Mar 2021 21:15:39 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35AFA610AF; Tue, 16 Mar 2021 21:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929344; h=from:from:reply-to:subject:subject: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=6lGNR1FXOQk6po1NGS81K9pZ4zMcV9JR4E7JUqbUu1c=; b=e64ubXOrbNT5LEepmSyEIaIrd0i8p+UylNEstgqYyel934BLR9vyw8quXCqbrlAW0l5Dn9 GgnGNSxsKJANf5SgRi9VGFKYXTS2ZPogukbRcBe2KV5/R4NpVmWgciWjXonzYimc8qivob G6qrA1z9SzwOy7jdvmr1jUjYJ2/QygQ= X-MC-Unique: 0828CIP9NO6v3NqTtRewqg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 04/16] fuzz: fix the pro100 generic-fuzzer config Date: Tue, 16 Mar 2021 17:15:19 -0400 Message-Id: <20210316211531.1649909-5-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Bulekov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Alexander Bulekov The device-type names for the pro100 network cards, are i8255.. We were matching "eepro", which catches the PCI PIO/MMIO regions for those devices, however misses the actual PCI device, which we use to map the BARs, before fuzzing. Fix that Signed-off-by: Alexander Bulekov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- tests/qtest/fuzz/generic_fuzz_configs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/fuzz/generic_fuzz_configs.h b/tests/qtest/fuzz/gen= eric_fuzz_configs.h index 5d599765c4..2454c627ff 100644 --- a/tests/qtest/fuzz/generic_fuzz_configs.h +++ b/tests/qtest/fuzz/generic_fuzz_configs.h @@ -177,7 +177,7 @@ const generic_fuzz_config predefined_configs[] =3D { .name =3D "i82550", .args =3D "-machine q35 -nodefaults " "-device i82550,netdev=3Dnet0 -netdev user,id=3Dnet0", - .objects =3D "eepro*" + .objects =3D "i8255*" },{ .name =3D "sdhci-v3", .args =3D "-nodefaults -device sdhci-pci,sd-spec-version=3D3 " --=20 2.26.2 From nobody Mon Feb 9 00:46:14 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615929882; cv=none; d=zohomail.com; s=zohoarc; b=MErSkRtYycBHQwAgjpQq7bsTwWj0r5/yb3l8lO1zkSOUoSGVxAemm4hjmERRumaN9v3zFbMg5nTx46UbVhQ0ETuAcu8AMKds4Jbfq6DAD8T5ePKhuLod8k5CHNpYkWXODoAQDHTBGcHeX2eSQKNQHqJDQzdxQnMsQUKbToLSDaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615929882; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bxuEem7eH3oi70ZALrvisRIbjREUWOlBR4STd9QYAFc=; b=nHKWf+lIHvM5rt/CTAXNaDWBHaKTNmMlRBH8riouMYzrhXFgN8IZqvWipTJ2rAcNVstEagf/SK0cMP7R7xMkD7XqA9DOrdRZSQzxOk2kJWjs5unSiNMHnW5vENAVb8gHM/UkevFJdAXANOTiYARmlZh2agSQ4h5NoJmphAkUmR8= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615929882867464.8988936766931; Tue, 16 Mar 2021 14:24:42 -0700 (PDT) Received: from localhost ([::1]:37350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMHBB-0000ug-R1 for importer@patchew.org; Tue, 16 Mar 2021 17:24:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2g-0005ae-Mk for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57580) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMH2W-0003Uu-1U for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:54 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-393-G69D9ZwIPzuGNeOjqqPjoA-1; Tue, 16 Mar 2021 17:15:41 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 097F9A40C0; Tue, 16 Mar 2021 21:15:40 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F805610AF; Tue, 16 Mar 2021 21:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929343; h=from:from:reply-to:subject:subject: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=bxuEem7eH3oi70ZALrvisRIbjREUWOlBR4STd9QYAFc=; b=Hcx99u2qvTvYtrIkzESpXtUHMQBSwPVVwAnKD4MHP+DrOlcjoaEYgq06FzlWzVHCdN5QTW zUO1pcnSwZIZH0wCLfmqq/c9lzqhEucGiqCR4nA1tkaBiKG4jMqQ3CafqNyDBURMcj1so1 rt3F31pN9WD2lmcilanpRGJdXahvfls= X-MC-Unique: G69D9ZwIPzuGNeOjqqPjoA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 05/16] fuzz: don't leave orphan llvm-symbolizers around Date: Tue, 16 Mar 2021 17:15:20 -0400 Message-Id: <20210316211531.1649909-6-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Bulekov , Thomas Huth , Darren Kenny Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Alexander Bulekov I noticed that with a sufficiently small timeout, the fuzzer fork-server sometimes locks up. On closer inspection, the issue appeared to be caused by entering our SIGALRM handler, while libfuzzer is in it's crash handlers. Because libfuzzer relies on pipe communication with an external child process to print out stack-traces, we shouldn't exit early, and leave an orphan child. Check for children in the SIGALRM handler to avoid this issue. Signed-off-by: Alexander Bulekov Acked-by: Thomas Huth Reviewed-by: Darren Kenny Signed-off-by: Paolo Bonzini --- tests/qtest/fuzz/generic_fuzz.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuz= z.c index ee8c17a04c..387ae2020a 100644 --- a/tests/qtest/fuzz/generic_fuzz.c +++ b/tests/qtest/fuzz/generic_fuzz.c @@ -583,6 +583,21 @@ static void handle_timeout(int sig) fprintf(stderr, "[Timeout]\n"); fflush(stderr); } + + /* + * If there is a crash, libfuzzer/ASAN forks a child to run an + * "llvm-symbolizer" process for printing out a pretty stacktrace. It + * communicates with this child using a pipe. If we timeout+Exit, whi= le + * libfuzzer is still communicating with the llvm-symbolizer child, we= will + * be left with an orphan llvm-symbolizer process. Sometimes, this app= ears + * to lead to a deadlock in the forkserver. Use waitpid to check if th= ere + * are any waitable children. If so, exit out of the signal-handler, a= nd + * let libfuzzer finish communicating with the child, and exit, on its= own. + */ + if (waitpid(-1, NULL, WNOHANG) =3D=3D 0) { + return; + } + _Exit(0); } =20 --=20 2.26.2 From nobody Mon Feb 9 00:46:14 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615929577; cv=none; d=zohomail.com; s=zohoarc; b=kKAFy+2Navp/rlj1nAu6IA3kud+mdbCc28jE2CL1KZCak1cc4AOlT9xGWXYolmGXP29Qc+DhZVc8uArbCMbj0gbDxHVbtvT9bDWdKYIbn+vIAU6fisMh1XbnLWKSIMz+wzcgMwFrTmazh1tf+g2MfIfp4jTYGF7Y2sOlPsrljCo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615929577; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bLb6EXcUZswqceAWj3ljcHA+pAGqWxfzkflfWVrZceI=; b=axq1NnBh/4v1WCBehuPvb5eMLBZz2FAfx/hoA21aFwfqSRAklmFZbUW3sGEaPEbHFkxCOJmD/spsht3gdsOG+bf7fx6scZtiesmU8lya53MFxkNZ4xlXOWofnEmDmq9NnkYoeOwwq5QjwfQXjbQ5ohfkcWsWc2qV8kdlGMK9TOY= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615929577088267.0765209997253; Tue, 16 Mar 2021 14:19:37 -0700 (PDT) Received: from localhost ([::1]:49186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMH6G-0002Pc-38 for importer@patchew.org; Tue, 16 Mar 2021 17:19:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2e-0005Uq-Sl for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42444) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2X-0003VD-S5 for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:52 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-295-UxWnmxvdNduKnMUiRV2bWg-1; Tue, 16 Mar 2021 17:15:41 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 744C0A40C1; Tue, 16 Mar 2021 21:15:40 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2409C610AF; Tue, 16 Mar 2021 21:15:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929344; h=from:from:reply-to:subject:subject: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=bLb6EXcUZswqceAWj3ljcHA+pAGqWxfzkflfWVrZceI=; b=gP9NddYabwLJzddaI/swEfRB40BycNf/CQ3z1wy3PJ45fv0Mtyk2WslcPHHkz7o2Z/hjS6 eVvNeIwEdU9NEi+3l0geQl7V/w4bVvGNgtxKp1XN8aKjpiP5KrWNAF3WWjAMio87WJiWUL JTX14/i+Zk4VeYgagjLvQyPZMNgYJe4= X-MC-Unique: UxWnmxvdNduKnMUiRV2bWg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 06/16] fuzz: add a script to build reproducers Date: Tue, 16 Mar 2021 17:15:21 -0400 Message-Id: <20210316211531.1649909-7-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Bulekov , Darren Kenny Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Alexander Bulekov Currently, bash and C crash reproducers are be built manually. This is a problem, as we want to integrate reproducers into the tree, for regression testing. This patch adds a script that converts a sequence of QTest commands into a pasteable Bash reproducer, or a libqtest-based C program. This will try to wrap pasteable reproducers to 72 chars, but the generated C code will not have nice formatting. Therefore, the C output of this script should be piped through an auto-formatter, such as clang-format Signed-off-by: Alexander Bulekov Reviewed-by: Darren Kenny Signed-off-by: Paolo Bonzini --- scripts/oss-fuzz/output_reproducer.py | 160 ++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100755 scripts/oss-fuzz/output_reproducer.py diff --git a/scripts/oss-fuzz/output_reproducer.py b/scripts/oss-fuzz/outpu= t_reproducer.py new file mode 100755 index 0000000000..3608b0600e --- /dev/null +++ b/scripts/oss-fuzz/output_reproducer.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +Convert plain qtest traces to C or Bash reproducers + +Use this to help build bug-reports or create in-tree reproducers for bugs. +Note: This will not format C code for you. Pipe the output through +clang-format -style=3D"{BasedOnStyle: llvm, IndentWidth: 4, ColumnLimit: 9= 0}" +or similar +""" + +import sys +import os +import argparse +import textwrap +from datetime import date + +__author__ =3D "Alexander Bulekov " +__copyright__ =3D "Copyright (C) 2021, Red Hat, Inc." +__license__ =3D "GPL version 2 or (at your option) any later version" + +__maintainer__ =3D "Alexander Bulekov" +__email__ =3D "alxndr@bu.edu" + + +def c_header(owner): + return """/* + * Autogenerated Fuzzer Test Case + * + * Copyright (c) {date} {owner} + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" + +#include "libqos/libqtest.h" + + """.format(date=3Ddate.today().year, owner=3Downer) + +def c_comment(s): + """ Return a multi-line C comment. Assume the text is already wrapped = """ + return "/*\n * " + "\n * ".join(s.splitlines()) + "\n*/" + +def print_c_function(s): + print("/* ") + for l in s.splitlines(): + print(" * {}".format(l)) + +def bash_reproducer(path, args, trace): + result =3D '\\\n'.join(textwrap.wrap("cat << EOF | {} {}".format(path,= args), + 72, break_on_hyphens=3DFalse, + drop_whitespace=3DFalse)) + for l in trace.splitlines(): + result +=3D "\n" + '\\\n'.join(textwrap.wrap(l,72,drop_whitespace= =3DFalse)) + result +=3D "\nEOF" + return result + +def c_reproducer(name, args, trace): + result =3D [] + result.append("""static void {}(void)\n{{""".format(name)) + + # libqtest will add its own qtest args, so get rid of them + args =3D args.replace("-accel qtest","") + args =3D args.replace(",accel=3Dqtest","") + args =3D args.replace("-machine accel=3Dqtest","") + args =3D args.replace("-qtest stdio","") + result.append("""QTestState *s =3D qtest_init("{}");""".format(args)) + for l in trace.splitlines(): + param =3D l.split() + cmd =3D param[0] + if cmd =3D=3D "write": + buf =3D param[3][2:] #Get the 0x... buffer and trim the "0x" + assert len(buf)%2 =3D=3D 0 + bufbytes =3D [buf[i:i+2] for i in range(0, len(buf), 2)] + bufstring =3D '\\x'+'\\x'.join(bufbytes) + addr =3D param[1] + size =3D param[2] + result.append("""qtest_bufwrite(s, {}, "{}", {});""".format( + addr, bufstring, size)) + elif cmd.startswith("in") or cmd.startswith("read"): + result.append("qtest_{}(s, {});".format( + cmd, param[1])) + elif cmd.startswith("out") or cmd.startswith("write"): + result.append("qtest_{}(s, {}, {});".format( + cmd, param[1], param[2])) + elif cmd =3D=3D "clock_step": + if len(param) =3D=3D1: + result.append("qtest_clock_step_next(s);") + else: + result.append("qtest_clock_step(s, {});".format(param[1])) + result.append("qtest_quit(s);\n}") + return "\n".join(result) + +def c_main(name, arch): + return """int main(int argc, char **argv) +{{ + const char *arch =3D qtest_get_arch(); + + g_test_init(&argc, &argv, NULL); + + if (strcmp(arch, "{arch}") =3D=3D 0) {{ + qtest_add_func("fuzz/{name}",{name}); + }} + + return g_test_run(); +}}""".format(name=3Dname, arch=3Darch) + +def main(): + parser =3D argparse.ArgumentParser() + group =3D parser.add_mutually_exclusive_group() + group.add_argument("-bash", help=3D"Only output a copy-pastable bash c= ommand", + action=3D"store_true") + group.add_argument("-c", help=3D"Only output a c function", + action=3D"store_true") + parser.add_argument('-owner', help=3D"If generating complete C source = code, \ + this specifies the Copyright owner", + nargs=3D'?', default=3D"") + parser.add_argument("-no_comment", help=3D"Don't include a bash reprod= ucer \ + as a comment in the C reproducers", + action=3D"store_true") + parser.add_argument('-name', help=3D"The name of the c function", + nargs=3D'?', default=3D"test_fuzz") + parser.add_argument('input_trace', help=3D"input QTest command sequenc= e \ + (stdin by default)", + nargs=3D'?', type=3Dargparse.FileType('r'), + default=3Dsys.stdin) + args =3D parser.parse_args() + + qemu_path =3D os.getenv("QEMU_PATH") + qemu_args =3D os.getenv("QEMU_ARGS") + if not qemu_args or not qemu_path: + print("Please set QEMU_PATH and QEMU_ARGS environment variables") + sys.exit(1) + + bash_args =3D qemu_args + if " -qtest stdio" not in qemu_args: + bash_args +=3D " -qtest stdio" + + arch =3D qemu_path.split("-")[-1] + trace =3D args.input_trace.read().strip() + + if args.bash : + print(bash_reproducer(qemu_path, bash_args, trace)) + else: + output =3D "" + if not args.c: + output +=3D c_header(args.owner) + "\n" + if not args.no_comment: + output +=3D c_comment(bash_reproducer(qemu_path, bash_args, tr= ace)) + output +=3D c_reproducer(args.name, qemu_args, trace) + if not args.c: + output +=3D c_main(args.name, arch) + print(output) + + +if __name__ =3D=3D '__main__': + main() --=20 2.26.2 From nobody Mon Feb 9 00:46:14 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615929731; cv=none; d=zohomail.com; s=zohoarc; b=CedgZKFryqBW1MeQKLFJ3yRN6JN80K58biaFFD/oIoXPldsjFurqCFlmrsQpLSs31dV7Aqdeuhpji820DJwFj2EXPAG1swXDfDrbrwSki4rXt5ZBy2l0498ImnL2raRCL75+YTKDNxKnJRz4Jr86TZFcMfRoJcNpknE8fKjd56g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615929731; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=i/DGdtQQ1rUmbZ91UH2o/Fu6b9EvArbb0mGvRXoUJYc=; b=EZADXZdvnEi6zBO8PzAkCvXvvMi4hOZ2/D46SCKiijp8tR6FjdkBm8kQXeZkppASrXXTJRZ/d3EdduUEwpUjVJWILtydaikZ7wPYSSObsjUfqV/LLAecvJizyrLOc4naAA59fTZPuZowYVBlzQXxUfzivSiBTeSd6YRT3flzcmI= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615929731409403.3746792672707; Tue, 16 Mar 2021 14:22:11 -0700 (PDT) Received: from localhost ([::1]:57800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMH8k-00065d-A4 for importer@patchew.org; Tue, 16 Mar 2021 17:22:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2f-0005WS-Bz for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMH2X-0003VC-SJ for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:53 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-453-5wlDERFwNueVMz-1cwacPQ-1; Tue, 16 Mar 2021 17:15:42 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DCE8F108BD07; Tue, 16 Mar 2021 21:15:40 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DD6B610AF; Tue, 16 Mar 2021 21:15:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929344; h=from:from:reply-to:subject:subject: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=i/DGdtQQ1rUmbZ91UH2o/Fu6b9EvArbb0mGvRXoUJYc=; b=Oau0YtiBwa7bjhW0Zfs5QSqrZAJ7gmimt+7PNzkmiOZrRjPZBxoOaXwHdvtP0GvSVjrTjc Yz5LN53adudEJiualByYKeUpTSXIlCIrWqS7OmhzH/Qhjh/MxABcIG4bXu4cg7qlKyOTj5 KmY9+JMRDXQ5gvwsH3mhB92jDGLizFo= X-MC-Unique: 5wlDERFwNueVMz-1cwacPQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 07/16] fuzz: add instructions for building reproducers Date: Tue, 16 Mar 2021 17:15:22 -0400 Message-Id: <20210316211531.1649909-8-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Bulekov , Darren Kenny Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Alexander Bulekov We have several scripts that help build reproducers, but no documentation for how they should be used. Add some documentation Signed-off-by: Alexander Bulekov Reviewed-by: Darren Kenny Signed-off-by: Paolo Bonzini --- docs/devel/fuzzing.rst | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/docs/devel/fuzzing.rst b/docs/devel/fuzzing.rst index 97797c4f8c..2749bb9bed 100644 --- a/docs/devel/fuzzing.rst +++ b/docs/devel/fuzzing.rst @@ -210,6 +210,62 @@ Build details: - The script responsible for building the fuzzers can be found in the QEMU source tree at ``scripts/oss-fuzz/build.sh`` =20 +Building Crash Reproducers +----------------------------------------- +When we find a crash, we should try to create an independent reproducer, t= hat +can be used on a non-fuzzer build of QEMU. This filters out any potential +false-positives, and improves the debugging experience for developers. +Here are the steps for building a reproducer for a crash found by the +generic-fuzz target. + +- Ensure the crash reproduces:: + + qemu-fuzz-i386 --fuzz-target... ./crash-... + +- Gather the QTest output for the crash:: + + QEMU_FUZZ_TIMEOUT=3D0 QTEST_LOG=3D1 FUZZ_SERIALIZE_QTEST=3D1 \ + qemu-fuzz-i386 --fuzz-target... ./crash-... &> /tmp/trace + +- Reorder and clean-up the resulting trace:: + + scripts/oss-fuzz/reorder_fuzzer_qtest_trace.py /tmp/trace > /tmp/repro= ducer + +- Get the arguments needed to start qemu, and provide a path to qemu:: + + less /tmp/trace # The args should be logged at the top of this file + export QEMU_ARGS=3D"-machine ..." + export QEMU_PATH=3D"path/to/qemu-system" + +- Ensure the crash reproduces in qemu-system:: + + $QEMU_PATH $QEMU_ARGS -qtest stdio < /tmp/reproducer + +- From the crash output, obtain some string that identifies the crash. This + can be a line in the stack-trace, for example:: + + export CRASH_TOKEN=3D"hw/usb/hcd-xhci.c:1865" + +- Minimize the reproducer:: + + scripts/oss-fuzz/minimize_qtest_trace.py -M1 -M2 \ + /tmp/reproducer /tmp/reproducer-minimized + +- Confirm that the minimized reproducer still crashes:: + + $QEMU_PATH $QEMU_ARGS -qtest stdio < /tmp/reproducer-minimized + +- Create a one-liner reproducer that can be sent over email:: + + ./scripts/oss-fuzz/output_reproducer.py -bash /tmp/reproducer-minimized + +- Output the C source code for a test case that will reproduce the bug:: + + ./scripts/oss-fuzz/output_reproducer.py -owner "John Smith "\ + -name "test_function_name" /tmp/reproducer-minimized + +- Report the bug and send a patch with the C reproducer upstream + Implementation Details / Fuzzer Lifecycle ----------------------------------------- =20 --=20 2.26.2 From nobody Mon Feb 9 00:46:14 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615930144; cv=none; d=zohomail.com; s=zohoarc; b=MVA0ZoLluBweWFWHOc9Pg48TkcbZmVga27yoS8We/t//5KC3M7TagVZ83ahM0G1PVH2eGKreR0DtAYurTebO8pjcB1x3zK2twc0cKz9l1EI84WHaj+EzXqGV0jbhHx+BumQGCEbnvQe1Z5GZkxMEOZPYo/7cjWmoUORIvmaVvGw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615930144; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wsQmMQn5LFiLfMBjSa+rg3JtmLRKpZoqTR15fTvhYD4=; b=iY5bEeLYyFsrc5vM2pW+gB84gbXCIsi9N6BT0/eFr796KOORvbGUPUvqVrkuQo6fQSU2iMHTQAKbriVEKcQr3hQbf2zzpYZ7VtSjEv2QJek2HQz4O3+hqTZkqpuTGXLARLE2uiS/CJ/6sIJA6TzZhAB6ViSSxXyfgs0TbSbu2vg= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615930144355502.1640280814155; Tue, 16 Mar 2021 14:29:04 -0700 (PDT) Received: from localhost ([::1]:50270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMHFP-0006MS-Bd for importer@patchew.org; Tue, 16 Mar 2021 17:29:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2h-0005bM-0z for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:56093) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMH2Z-0003WD-VE for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:54 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-306-KjQCME-HOyig9B2dPDOxkg-1; Tue, 16 Mar 2021 17:15:42 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 53127100C618; Tue, 16 Mar 2021 21:15:41 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 030BD1378D; Tue, 16 Mar 2021 21:15:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929346; h=from:from:reply-to:subject:subject: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=wsQmMQn5LFiLfMBjSa+rg3JtmLRKpZoqTR15fTvhYD4=; b=CGMz4T973ft6xxmyWx9iaLHDDwOoU7lmdpxoc86ozdTtZ/4thPwUK4Ko6IYnKB5+JPxLw5 15nLHuAkYX2bAcfJL63tbeq6Za85btRv0/D8Na8YLAYWw7iqL+MIJG0bzGuUKoqeznUNSh rplSpuDIwUPp2RLj4bjO/KfZAL0jZoY= X-MC-Unique: KjQCME-HOyig9B2dPDOxkg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 08/16] fuzz: add a am53c974 generic-fuzzer config Date: Tue, 16 Mar 2021 17:15:23 -0400 Message-Id: <20210316211531.1649909-9-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Bulekov , Darren Kenny Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Alexander Bulekov Signed-off-by: Alexander Bulekov Reviewed-by: Darren Kenny Signed-off-by: Paolo Bonzini --- tests/qtest/fuzz/generic_fuzz_configs.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/qtest/fuzz/generic_fuzz_configs.h b/tests/qtest/fuzz/gen= eric_fuzz_configs.h index 2454c627ff..8b8c7ac553 100644 --- a/tests/qtest/fuzz/generic_fuzz_configs.h +++ b/tests/qtest/fuzz/generic_fuzz_configs.h @@ -208,6 +208,12 @@ const generic_fuzz_config predefined_configs[] =3D { .args =3D "-machine q35 -nodefaults -device megasas -device scsi-c= d,drive=3Dnull0 " "-blockdev driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnull0", .objects =3D "megasas*", + },{ + .name =3D "am53c974", + .args =3D "-device am53c974,id=3Dscsi -device scsi-hd,drive=3Ddisk= 0 " + "-drive id=3Ddisk0,if=3Dnone,file=3Dnull-co://,format=3Dr= aw " + "-nodefaults", + .objects =3D "*esp* *scsi* *am53c974*", },{ .name =3D "ac97", .args =3D "-machine q35 -nodefaults " --=20 2.26.2 From nobody Mon Feb 9 00:46:14 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615930039; cv=none; d=zohomail.com; s=zohoarc; b=cexLZs5pmn2ffyMK08maNtaIWGiCIGdwBY6+vrf9eO7gRDO/5keJypEtUdne4c1lRXrv9mVmZBNwGux3jAM0883pCjB8dBwe2mhNR+X54yCgBC2lNU5aVC1NjzLiVlI+mEFxa9aXqHOw2S6HbTm7n5UDoKU0B02g9dSdOuMhRq4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615930039; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vZXSIHp0JmDXWhRC+N/MuL0H43fnG/VNZgno+EIqtas=; b=O+u9XLf965eNesAY5qDQWNjhMUYNeSH3KzGDFg8xuoxP3ONxzqBS7hA9Hd/kSkSDdaL/VwhA/G+zLWHL0pazjDfu0DL83jgSwuIYs4hTHaAZ+wOFQNdG8vHPqpxOdX7kELI7rlurgssFQmh6C2E9hA5Z6n+wRrANAMKItHbdB1M= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615930039919810.7365924048693; Tue, 16 Mar 2021 14:27:19 -0700 (PDT) Received: from localhost ([::1]:43978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMHDi-0003kc-1w for importer@patchew.org; Tue, 16 Mar 2021 17:27:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2h-0005bp-2J for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52598) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMH2X-0003VT-SI for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:54 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-505-xBmg3mr_NeCZYtC5VjdJcw-1; Tue, 16 Mar 2021 17:15:43 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BCB97100C61B; Tue, 16 Mar 2021 21:15:41 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C9261378D; Tue, 16 Mar 2021 21:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929345; h=from:from:reply-to:subject:subject: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=vZXSIHp0JmDXWhRC+N/MuL0H43fnG/VNZgno+EIqtas=; b=QqlglqyezFOc6EVoJf00OY/qLdaJz9XKIeD7Xs6gddq6lTKBlGmqVoVZEUdZQhJcz8vWlq umac5LjlfzDX2TS4a891EReLPbv9V1u8OKUEwYEuIVgX/a1/CMbcLYM2Nqo1Fw8r0argdo oDHFsZRSy+X6w5nK8ySdrz+f9IK059A= X-MC-Unique: xBmg3mr_NeCZYtC5VjdJcw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 09/16] memory: add a sparse memory device for fuzzing Date: Tue, 16 Mar 2021 17:15:24 -0400 Message-Id: <20210316211531.1649909-10-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Bulekov , Darren Kenny Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Alexander Bulekov For testing, it can be useful to simulate an enormous amount of memory (e.g. 2^64 RAM). This adds an MMIO device that acts as sparse memory. When something writes a nonzero value to a sparse-mem address, we allocate a block of memory. For now, since the only user of this device is the fuzzer, we do not track and free zeroed blocks. The device has a very low priority (so it can be mapped beneath actual RAM, and virtual device MMIO regions). Signed-off-by: Alexander Bulekov Reviewed-by: Darren Kenny Signed-off-by: Paolo Bonzini --- MAINTAINERS | 1 + hw/mem/meson.build | 1 + hw/mem/sparse-mem.c | 151 ++++++++++++++++++++++++++++++++++++ include/hw/mem/sparse-mem.h | 19 +++++ 4 files changed, 172 insertions(+) create mode 100644 hw/mem/sparse-mem.c create mode 100644 include/hw/mem/sparse-mem.h diff --git a/MAINTAINERS b/MAINTAINERS index 0bd720a3d6..2a925e76ea 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2636,6 +2636,7 @@ S: Maintained F: tests/qtest/fuzz/ F: tests/qtest/fuzz-*test.c F: scripts/oss-fuzz/ +F: hw/mem/sparse-mem.c F: docs/devel/fuzzing.rst =20 Register API diff --git a/hw/mem/meson.build b/hw/mem/meson.build index 0d22f2b572..ef79e04678 100644 --- a/hw/mem/meson.build +++ b/hw/mem/meson.build @@ -1,5 +1,6 @@ mem_ss =3D ss.source_set() mem_ss.add(files('memory-device.c')) +mem_ss.add(when: 'CONFIG_FUZZ', if_true: files('sparse-mem.c')) mem_ss.add(when: 'CONFIG_DIMM', if_true: files('pc-dimm.c')) mem_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_mc.c')) mem_ss.add(when: 'CONFIG_NVDIMM', if_true: files('nvdimm.c')) diff --git a/hw/mem/sparse-mem.c b/hw/mem/sparse-mem.c new file mode 100644 index 0000000000..a13ac74dd9 --- /dev/null +++ b/hw/mem/sparse-mem.c @@ -0,0 +1,151 @@ +/* + * A sparse memory device. Useful for fuzzing + * + * Copyright Red Hat Inc., 2021 + * + * Authors: + * Alexander Bulekov + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" + +#include "exec/address-spaces.h" +#include "hw/qdev-properties.h" +#include "hw/sysbus.h" +#include "qapi/error.h" +#include "qemu/units.h" +#include "sysemu/qtest.h" +#include "hw/mem/sparse-mem.h" + +#define SPARSE_MEM(obj) OBJECT_CHECK(SparseMemState, (obj), TYPE_SPARSE_ME= M) +#define SPARSE_BLOCK_SIZE 0x1000 + +typedef struct SparseMemState { + SysBusDevice parent_obj; + MemoryRegion mmio; + uint64_t baseaddr; + uint64_t length; + uint64_t size_used; + uint64_t maxsize; + GHashTable *mapped; +} SparseMemState; + +typedef struct sparse_mem_block { + uint8_t data[SPARSE_BLOCK_SIZE]; +} sparse_mem_block; + +static uint64_t sparse_mem_read(void *opaque, hwaddr addr, unsigned int si= ze) +{ + SparseMemState *s =3D opaque; + uint64_t ret =3D 0; + size_t pfn =3D addr / SPARSE_BLOCK_SIZE; + size_t offset =3D addr % SPARSE_BLOCK_SIZE; + sparse_mem_block *block; + + block =3D g_hash_table_lookup(s->mapped, (void *)pfn); + if (block) { + assert(offset + size <=3D sizeof(block->data)); + memcpy(&ret, block->data + offset, size); + } + return ret; +} + +static void sparse_mem_write(void *opaque, hwaddr addr, uint64_t v, + unsigned int size) +{ + SparseMemState *s =3D opaque; + size_t pfn =3D addr / SPARSE_BLOCK_SIZE; + size_t offset =3D addr % SPARSE_BLOCK_SIZE; + sparse_mem_block *block; + + if (!g_hash_table_lookup(s->mapped, (void *)pfn) && + s->size_used + SPARSE_BLOCK_SIZE < s->maxsize && v) { + g_hash_table_insert(s->mapped, (void *)pfn, + g_new0(sparse_mem_block, 1)); + s->size_used +=3D sizeof(block->data); + } + block =3D g_hash_table_lookup(s->mapped, (void *)pfn); + if (!block) { + return; + } + + assert(offset + size <=3D sizeof(block->data)); + + memcpy(block->data + offset, &v, size); + +} + +static const MemoryRegionOps sparse_mem_ops =3D { + .read =3D sparse_mem_read, + .write =3D sparse_mem_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .valid =3D { + .min_access_size =3D 1, + .max_access_size =3D 8, + .unaligned =3D false, + }, +}; + +static Property sparse_mem_properties[] =3D { + /* The base address of the memory */ + DEFINE_PROP_UINT64("baseaddr", SparseMemState, baseaddr, 0x0), + /* The length of the sparse memory region */ + DEFINE_PROP_UINT64("length", SparseMemState, length, UINT64_MAX), + /* Max amount of actual memory that can be used to back the sparse mem= ory */ + DEFINE_PROP_UINT64("maxsize", SparseMemState, maxsize, 10 * MiB), + DEFINE_PROP_END_OF_LIST(), +}; + +MemoryRegion *sparse_mem_init(uint64_t addr, uint64_t length) +{ + DeviceState *dev; + + dev =3D qdev_new(TYPE_SPARSE_MEM); + qdev_prop_set_uint64(dev, "baseaddr", addr); + qdev_prop_set_uint64(dev, "length", length); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map_overlap(SYS_BUS_DEVICE(dev), 0, addr, -10000); + return &SPARSE_MEM(dev)->mmio; +} + +static void sparse_mem_realize(DeviceState *dev, Error **errp) +{ + SparseMemState *s =3D SPARSE_MEM(dev); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); + + if (!qtest_enabled()) { + error_setg(errp, "sparse_mem device should only be used " + "for testing with QTest"); + return; + } + + assert(s->baseaddr + s->length > s->baseaddr); + + s->mapped =3D g_hash_table_new(NULL, NULL); + memory_region_init_io(&s->mmio, OBJECT(s), &sparse_mem_ops, s, + "sparse-mem", s->length); + sysbus_init_mmio(sbd, &s->mmio); +} + +static void sparse_mem_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + device_class_set_props(dc, sparse_mem_properties); + + dc->desc =3D "Sparse Memory Device"; + dc->realize =3D sparse_mem_realize; +} + +static const TypeInfo sparse_mem_types[] =3D { + { + .name =3D TYPE_SPARSE_MEM, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(SparseMemState), + .class_init =3D sparse_mem_class_init, + }, +}; +DEFINE_TYPES(sparse_mem_types); diff --git a/include/hw/mem/sparse-mem.h b/include/hw/mem/sparse-mem.h new file mode 100644 index 0000000000..f9863b154b --- /dev/null +++ b/include/hw/mem/sparse-mem.h @@ -0,0 +1,19 @@ +/* + * A sparse memory device. Useful for fuzzing + * + * Copyright Red Hat Inc., 2021 + * + * Authors: + * Alexander Bulekov + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#ifndef SPARSE_MEM_H +#define SPARSE_MEM_H +#define TYPE_SPARSE_MEM "sparse-mem" + +MemoryRegion *sparse_mem_init(uint64_t addr, uint64_t length); + +#endif --=20 2.26.2 From nobody Mon Feb 9 00:46:14 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615929576; cv=none; d=zohomail.com; s=zohoarc; b=Usmv/VCfX/QKAWBbQMikpc/8H0F+AguKgcC9ZvOIveqagl1m2fyn19C6WAs5OZaRVZgwdWu/cLdxBlXOlAXRb+jlJDfSQYYs8X/HgV+eMXTrlsI1WXBzqNbZHy80mHxeYo/tFN9/7ANvCe3Yy/mCYVUxdE8lNqFecO0v2EI/izU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615929576; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VIHxetl+1S54Ce2FW6zBf/iw6yqFL697K4bAPaglIkc=; b=KCrt446AzQhRA0Mk85uJriWsKxdbXQbjX83BpdZuVcYTTPgOSIoeiJWAvyN7fMDDLaHFgmV9RnIY4sFNOg4Cc7vuLwzNiL8esfwviJwW93bp0X4mnnZjkSl864UqDE8xX0ty4gUyx3ibcswVdwh6DtVIULVC6agtuLYCiJNV6lI= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615929576468721.1523689108227; Tue, 16 Mar 2021 14:19:36 -0700 (PDT) Received: from localhost ([::1]:49118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMH6F-0002Nt-DI for importer@patchew.org; Tue, 16 Mar 2021 17:19:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2g-0005ZO-9u for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29440) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMH2Y-0003Va-Ro for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:53 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-313-e20aUCI6OKqG5ceR_1zU8g-1; Tue, 16 Mar 2021 17:15:43 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A4FBA40C0; Tue, 16 Mar 2021 21:15:42 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39320610AF; Tue, 16 Mar 2021 21:15:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929345; h=from:from:reply-to:subject:subject: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=VIHxetl+1S54Ce2FW6zBf/iw6yqFL697K4bAPaglIkc=; b=DWRFPtQJm2hexEMIa5EuEH7cvbO0bb4qPmaH3s9iZjffxR/r2P4DyE0macgs5XjIBwplqv vq9C4cI/DA91zMBjCbRn/UPsLWE2byhrFQrsr2wyAowx02ja4rhiiJFH4JxYSO/5VZn1D3 rBRm6VjlvOXGtP0544y+ZCzpI/J1Tlo= X-MC-Unique: e20aUCI6OKqG5ceR_1zU8g-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 10/16] fuzz: configure a sparse-mem device, by default Date: Tue, 16 Mar 2021 17:15:25 -0400 Message-Id: <20210316211531.1649909-11-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=216.205.24.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Bulekov , Darren Kenny Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Alexander Bulekov The generic-fuzzer often provides randomized DMA addresses to virtual-devices. For a 64-bit address-space, the chance of these randomized addresses coinciding with RAM regions, is fairly small. Even though the fuzzer's instrumentation eventually finds valid addresses, this can take some-time, and slows-down fuzzing progress (especially, when multiple DMA buffers are involved). To work around this, create "fake" sparse-memory that spans all of the 64-bit address-space. Adjust the DMA call-back to populate this sparse memory, correspondingly Signed-off-by: Alexander Bulekov Reviewed-by: Darren Kenny Signed-off-by: Paolo Bonzini --- tests/qtest/fuzz/generic_fuzz.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuz= z.c index 387ae2020a..b5fe27aae1 100644 --- a/tests/qtest/fuzz/generic_fuzz.c +++ b/tests/qtest/fuzz/generic_fuzz.c @@ -28,6 +28,7 @@ #include "hw/pci/pci.h" #include "hw/boards.h" #include "generic_fuzz_configs.h" +#include "hw/mem/sparse-mem.h" =20 /* * SEPARATOR is used to separate "operations" in the fuzz input @@ -64,6 +65,8 @@ static useconds_t timeout =3D DEFAULT_TIMEOUT_US; =20 static bool qtest_log_enabled; =20 +MemoryRegion *sparse_mem_mr; + /* * A pattern used to populate a DMA region or perform a memwrite. This is * useful for e.g. populating tables of unique addresses. @@ -191,8 +194,7 @@ void fuzz_dma_read_cb(size_t addr, size_t len, MemoryRe= gion *mr) */ if (dma_patterns->len =3D=3D 0 || len =3D=3D 0 - || mr !=3D current_machine->ram - || addr > current_machine->ram_size) { + || (mr !=3D current_machine->ram && mr !=3D sparse_mem_mr)) { return; } =20 @@ -238,7 +240,7 @@ void fuzz_dma_read_cb(size_t addr, size_t len, MemoryRe= gion *mr) MEMTXATTRS_UNSPECIFIED); =20 if (!(memory_region_is_ram(mr1) || - memory_region_is_romd(mr1))) { + memory_region_is_romd(mr1)) && mr1 !=3D sparse_mem_mr) { l =3D memory_access_size(mr1, l, addr1); } else { /* ROM/RAM case */ @@ -814,6 +816,12 @@ static void generic_pre_fuzz(QTestState *s) } qts_global =3D s; =20 + /* + * Create a special device that we can use to back DMA buffers at very + * high memory addresses + */ + sparse_mem_mr =3D sparse_mem_init(0, UINT64_MAX); + dma_regions =3D g_array_new(false, false, sizeof(address_range)); dma_patterns =3D g_array_new(false, false, sizeof(pattern)); =20 --=20 2.26.2 From nobody Mon Feb 9 00:46:14 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615929730; cv=none; d=zohomail.com; s=zohoarc; b=IEejz5v4QQ81MV3xy/0/MwGdwAyD1F+1+9U7rK2S24uFcU5SSUlMgbMsJUc7/Rls6Cl0XT8xztmUjFXyPew4xbTHGtE62a0jEmczKOzYh7uNB74f29NJ56VRYnzGdl8E/9UFcBsAk+BQBseNV9ZIika+tqY4hJf0Q7tTxbDmC8M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615929730; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OAYmPS1ld/F4OC51Pp+PAerAmgSmDz1sEiakNbEAn+g=; b=L5u/WfFmc9VoytW+jMcOiRxl2Hj4yAWqIKU3hQAS7eVItj1JMfhCnTSvj2nEQpqfBVh6zoQfF8D5r6amS2xhg1O0cvQ3z/3c5+y2Pri6/jb7slzuLOFGKmBfpuD6f343aC90cKJdai2HxgEkIwUdboPBSBcsraXv0nfBzIDNJDc= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615929730080863.4416728425874; Tue, 16 Mar 2021 14:22:10 -0700 (PDT) Received: from localhost ([::1]:57618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMH8i-00061A-VZ for importer@patchew.org; Tue, 16 Mar 2021 17:22:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2i-0005fH-H2 for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:33502) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMH2Z-0003WF-VT for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:56 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-422-aeE0HzcVMdyMcGzOD8dlfw-1; Tue, 16 Mar 2021 17:15:44 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F335DA40C3; Tue, 16 Mar 2021 21:15:42 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3A0550329; Tue, 16 Mar 2021 21:15:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929346; h=from:from:reply-to:subject:subject: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=OAYmPS1ld/F4OC51Pp+PAerAmgSmDz1sEiakNbEAn+g=; b=hQVHEV2ikAJSQxU2oWD771ia+i0ubwiesqgqbZzufOhpZNPiEr3YtlOMmtSq3sowdUi37u GyE/T4ils9U9v+JXl2sJBK0vDnGByqtzglPav74R7pUcrwfo70tIbqtEq89U2no3yISeGA SN1DXHNA+DExDMh58WKKksQedULbRA4= X-MC-Unique: aeE0HzcVMdyMcGzOD8dlfw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 11/16] fuzz: move some DMA hooks Date: Tue, 16 Mar 2021 17:15:26 -0400 Message-Id: <20210316211531.1649909-12-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Bulekov , Darren Kenny Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Alexander Bulekov For the sparse-mem device, we want the fuzzer to populate entire DMA reads from sparse-mem, rather than hooking into the individual MMIO memory_region_dispatch_read operations. Otherwise, the fuzzer will treat each sequential read separately (and populate it with a separate pattern). Work around this by rearranging some DMA hooks. Since the fuzzer has it's own logic to skip accidentally writing to MMIO regions, we can call the DMA cb, outside the flatview_translate loop. Signed-off-by: Alexander Bulekov Reviewed-by: Darren Kenny Signed-off-by: Paolo Bonzini --- softmmu/memory.c | 1 - softmmu/physmem.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/softmmu/memory.c b/softmmu/memory.c index 9db47b7db6..c4730ec47a 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -1440,7 +1440,6 @@ MemTxResult memory_region_dispatch_read(MemoryRegion = *mr, unsigned size =3D memop_size(op); MemTxResult r; =20 - fuzz_dma_read_cb(addr, size, mr); if (!memory_region_access_valid(mr, addr, size, false, attrs)) { *pval =3D unassigned_mem_read(mr, addr, size); return MEMTX_DECODE_ERROR; diff --git a/softmmu/physmem.c b/softmmu/physmem.c index 7e8b0fab89..6a58c86750 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -2831,6 +2831,7 @@ MemTxResult flatview_read_continue(FlatView *fv, hwad= dr addr, bool release_lock =3D false; uint8_t *buf =3D ptr; =20 + fuzz_dma_read_cb(addr, len, mr); for (;;) { if (!memory_access_is_direct(mr, false)) { /* I/O case */ @@ -2841,7 +2842,6 @@ MemTxResult flatview_read_continue(FlatView *fv, hwad= dr addr, stn_he_p(buf, l, val); } else { /* RAM case */ - fuzz_dma_read_cb(addr, len, mr); ram_ptr =3D qemu_ram_ptr_length(mr->ram_block, addr1, &l, fals= e); memcpy(buf, ram_ptr, l); } --=20 2.26.2 From nobody Mon Feb 9 00:46:14 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615929575; cv=none; d=zohomail.com; s=zohoarc; b=ZYnpeUw/xtUj05Ws6QJA6EFvN+EKb2k5nWWi2gfXuL28YnTMjQbStgdXfOoYoBl58xxEsUDeXhBAvyRaj01gnRI/d5F3/mHRxKk1cg9PKQ4yVeZgC8OmW/+pQLB1TPuAPDIx0XvN1Faz1s1jndiuitRfK4wh4vYCmVrfZi3LBz8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615929575; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fBoqlLC/BhqsNfuI2cl/rqg1pW0BJW/8ArptsabiTFY=; b=LNiNLaYe8Vm0zmZxgGfJdWIUSzcqZ/gwCnFmKFUuB1dbcesGI9cd7xHkJkTtJNDEB72092Tdvg7tduAGV89V7mlkjG/1MpP2of2JxGK4QglvVbHz47qVW2Xe1kHAAcG4OfFI1iGGf9cYqW6Wm3KvAfYLF9tslE5YIYBL83aV/lE= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161592957565663.93956870045804; Tue, 16 Mar 2021 14:19:35 -0700 (PDT) Received: from localhost ([::1]:49090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMH6E-0002N5-LN for importer@patchew.org; Tue, 16 Mar 2021 17:19:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51988) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2h-0005de-RV for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:31939) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMH2Z-0003WR-W1 for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:55 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-562-IbMgs1J7NoqO5PgGHIXUTQ-1; Tue, 16 Mar 2021 17:15:44 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 81C7C80006E; Tue, 16 Mar 2021 21:15:43 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18EAC5032D; Tue, 16 Mar 2021 21:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929347; h=from:from:reply-to:subject:subject: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=fBoqlLC/BhqsNfuI2cl/rqg1pW0BJW/8ArptsabiTFY=; b=JFGPjIVyguQHo9A6O/BRd5QZBHywlGY3/4TgRQM+rBWJ9s1W+HiK6p6cRWLJBNXnb6LTbr 4ZguJycorrlcFhurgIhzmBILWq01ogyRKkrXl9XBKVLcPu4ZguqBaiV3MxJzfSkUW7UpwF S9VesgpgE9kqVTjKercBlxM5nlZUMuI= X-MC-Unique: IbMgs1J7NoqO5PgGHIXUTQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 12/16] configure: add option to explicitly enable/disable libgio Date: Tue, 16 Mar 2021 17:15:27 -0400 Message-Id: <20210316211531.1649909-13-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Denis Plotnikov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Denis Plotnikov Now, compilation of util/dbus is implicit and depends on libgio presence on the building host. The patch adds options to manage libgio dependencies explicitly. Signed-off-by: Denis Plotnikov Message-Id: <20210312151440.405776-1-den-plotnikov@yandex-team.ru> Signed-off-by: Paolo Bonzini --- configure | 60 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/configure b/configure index f7d022a5db..847bc4d095 100755 --- a/configure +++ b/configure @@ -465,6 +465,7 @@ fuse_lseek=3D"auto" multiprocess=3D"auto" =20 malloc_trim=3D"auto" +gio=3D"$default_feature" =20 # parse CC options second for opt do @@ -1560,6 +1561,10 @@ for opt do ;; --disable-multiprocess) multiprocess=3D"disabled" ;; + --enable-gio) gio=3Dyes + ;; + --disable-gio) gio=3Dno + ;; *) echo "ERROR: unknown option $opt" echo "Try '$0 --help' for more information" @@ -1913,6 +1918,7 @@ disabled with --disable-FEATURE, default is enabled i= f available fuse FUSE block device export fuse-lseek SEEK_HOLE/SEEK_DATA support for FUSE exports multiprocess Out of process device emulation support + gio libgio support =20 NOTE: The object files are built at the place where configure is launched EOF @@ -3319,17 +3325,19 @@ if test "$static" =3D yes && test "$mingw32" =3D ye= s; then glib_cflags=3D"-DGLIB_STATIC_COMPILATION $glib_cflags" fi =20 -if $pkg_config --atleast-version=3D$glib_req_ver gio-2.0; then - gio_cflags=3D$($pkg_config --cflags gio-2.0) - gio_libs=3D$($pkg_config --libs gio-2.0) - gdbus_codegen=3D$($pkg_config --variable=3Dgdbus_codegen gio-2.0) - if [ ! -x "$gdbus_codegen" ]; then - gdbus_codegen=3D - fi - # Check that the libraries actually work -- Ubuntu 18.04 ships - # with pkg-config --static --libs data for gio-2.0 that is missing - # -lblkid and will give a link error. - cat > $TMPC < $TMPC < int main(void) { @@ -3337,18 +3345,28 @@ int main(void) return 0; } EOF - if compile_prog "$gio_cflags" "$gio_libs" ; then - gio=3Dyes - else - gio=3Dno + if compile_prog "$gio_cflags" "$gio_libs" ; then + pass=3Dyes + else + pass=3Dno + fi + + if test "$pass" =3D "yes" && + $pkg_config --atleast-version=3D$glib_req_ver gio-unix-2.0; th= en + gio_cflags=3D"$gio_cflags $($pkg_config --cflags gio-unix-2.0)" + gio_libs=3D"$gio_libs $($pkg_config --libs gio-unix-2.0)" + fi fi -else - gio=3Dno -fi =20 -if $pkg_config --atleast-version=3D$glib_req_ver gio-unix-2.0; then - gio_cflags=3D"$gio_cflags $($pkg_config --cflags gio-unix-2.0)" - gio_libs=3D"$gio_libs $($pkg_config --libs gio-unix-2.0)" + if test "$pass" =3D "no"; then + if test "$gio" =3D "yes"; then + feature_not_found "gio" "Install libgio >=3D 2.0" + else + gio=3Dno + fi + else + gio=3Dyes + fi fi =20 # Sanity check that the current size_t matches the --=20 2.26.2 From nobody Mon Feb 9 00:46:14 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615929731; cv=none; d=zohomail.com; s=zohoarc; b=allzjV9URPkXW8DMQKcb/hMtEUpLagRzii0G7eia1qnmSS5fPzRWysORxPhEgy7Y4dJcjdO2oOxru0exaxM13lxcvWpaqL6DbMocMZtzUGEZbPNj7BwDhRjtWcRMybx4kq9lstbR1TF+h/7SDBee0EuuRvUaHSB6VSp8s1qbC/k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615929731; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DsN4/rvHHU48Yr6aQ62htF/9dKQLdus/U7a075wQNHE=; b=A48EL5EMRkQ+cxtju/hBSm6/mtvzo0B3XMXKZCZpWC+y4XRoLTMrAz8a7hv4hQ/bTtZ7qHP8jIbyhRXda0gjO9M+e1E3AyYBdjE8VCgnkuAIwSGEJGZ/dCLJ/yPrw8rLVfmAZChiIvHa4B3eq2/9wQvT99FDYHN/9uPv0Dw0b0E= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615929731518501.07585072867744; Tue, 16 Mar 2021 14:22:11 -0700 (PDT) Received: from localhost ([::1]:57786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMH8k-000659-GB for importer@patchew.org; Tue, 16 Mar 2021 17:22:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2h-0005dn-ST for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42422) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMH2a-0003WB-2Z for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:55 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-564-bNsMNdJhNMSs8l4nwOwlaQ-1; Tue, 16 Mar 2021 17:15:44 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CD01183DD21 for ; Tue, 16 Mar 2021 21:15:43 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BED150331 for ; Tue, 16 Mar 2021 21:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929346; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DsN4/rvHHU48Yr6aQ62htF/9dKQLdus/U7a075wQNHE=; b=ZoqjnNv/mWRf74xi7UiL7TCizhC2NybQOvzS1kyq9Ihnp3jtBFVZNytGmcryLi4IXUE9Ln /FFRqPL4vRlU1+A+dgpmKoDxXow/UavDv2WeSWr+h1PEmITgts+G9xlscVgbD8EU8N/tQH wpBUVFeA9A5q8+1kMyaTe32fEd/fI0k= X-MC-Unique: bNsMNdJhNMSs8l4nwOwlaQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 13/16] Revert "accel: kvm: Add aligment assert for kvm_log_clear_one_slot" Date: Tue, 16 Mar 2021 17:15:28 -0400 Message-Id: <20210316211531.1649909-14-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This reverts commit 3920552846e881bafa9f9aad0bb1a6eef874d7fb. Thomas Huth reported a failure with CentOS 6 guests: ../../devel/qemu/accel/kvm/kvm-all.c:690: kvm_log_clear_one_slot: Assertion= `QEMU_IS_ALIGNED(start | size, psize)' failed. Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 37b0a1861e..b6d9f92f15 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -673,10 +673,6 @@ out: #define KVM_CLEAR_LOG_ALIGN (qemu_real_host_page_size << KVM_CLEAR_LOG_SH= IFT) #define KVM_CLEAR_LOG_MASK (-KVM_CLEAR_LOG_ALIGN) =20 -/* - * As the granule of kvm dirty log is qemu_real_host_page_size, - * @start and @size are expected and restricted to align to it. - */ static int kvm_log_clear_one_slot(KVMSlot *mem, int as_id, uint64_t start, uint64_t size) { @@ -686,9 +682,6 @@ static int kvm_log_clear_one_slot(KVMSlot *mem, int as_= id, uint64_t start, unsigned long *bmap_clear =3D NULL, psize =3D qemu_real_host_page_size; int ret; =20 - /* Make sure start and size are qemu_real_host_page_size aligned */ - assert(QEMU_IS_ALIGNED(start | size, psize)); - /* * We need to extend either the start or the size or both to * satisfy the KVM interface requirement. Firstly, do the start --=20 2.26.2 From nobody Mon Feb 9 00:46:14 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615930234; cv=none; d=zohomail.com; s=zohoarc; b=iraJiPfYaU8j6pj+rF4IaFaCRpI3ocj+VIStLiWfC6TeNpq359pMJgKIdixmEQq8xtcscRlrcnT+EGhF7C9Z79P/ybd1vgd1qboLEewUAslEGhe5/vK8EvLgqaqgGNgCS8xF/Wo4YVtACjyIcbwhArMkr4gTm2jzHNlKztzJVFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615930234; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=S8ADA7f0balS7dN4pePZzfFw3zoFhhZFbYVG5icg2rM=; b=G8FIf4bM74VrkwpQc48ZvzCaJ/Ykyu8hjjM16rw64B3AWvcdRk/NYyYS9nc3DovnOSuNEQcLjSEmxEcPYE8TeaBqvzMtMjnK4UTXVaX+JaTncmrG6hIbOxCURXag2HL0T6dbyBACCn0fVx2bBvzI/H0oi3JV5qACusxnv8nPhLo= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615930234602850.7804100241833; Tue, 16 Mar 2021 14:30:34 -0700 (PDT) Received: from localhost ([::1]:54546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMHGr-00085s-Fk for importer@patchew.org; Tue, 16 Mar 2021 17:30:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2j-0005ic-SP for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:38378) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2e-0003XX-7t for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:57 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-42-fI-R5tJ-Mz6kJ6GBqLtsxw-1; Tue, 16 Mar 2021 17:15:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6A87B192D785 for ; Tue, 16 Mar 2021 21:15:48 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id E862B50329; Tue, 16 Mar 2021 21:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929351; h=from:from:reply-to:subject:subject: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=S8ADA7f0balS7dN4pePZzfFw3zoFhhZFbYVG5icg2rM=; b=jUs+H8iZ7+GWf147aBGrQAadfvo2kPyj3s9GVSCFKWLKmjATqBguwDDN0mE4rY0KVI5s9I MlIWtwGUwNl4YUs2XuueerXYi4jBSpigP49IsXXt+WiIxyXDH9PPMHxfXjCzTtMBCeC2Dj 5cV0igFe8NlRBLooW94SPcI0XNILEds= X-MC-Unique: fI-R5tJ-Mz6kJ6GBqLtsxw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 14/16] scsi: fix sense code for EREMOTEIO Date: Tue, 16 Mar 2021 17:15:29 -0400 Message-Id: <20210316211531.1649909-15-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) SENSE_CODE(LUN_COMM_FAILURE) has an ABORTED COMMAND sense key, so it results in a retry in Linux. To ensure that EREMOTEIO is forwarded to the guest, use a HARDWARE ERROR sense key instead. Note that the code before commit d7a84021d was incorrect because it used HARDWARE_ERROR as a SCSI status, not as a sense key. Reported-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- scsi/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scsi/utils.c b/scsi/utils.c index 873e05aeaf..357b036671 100644 --- a/scsi/utils.c +++ b/scsi/utils.c @@ -589,7 +589,7 @@ int scsi_sense_from_errno(int errno_value, SCSISense *s= ense) return TASK_SET_FULL; #ifdef CONFIG_LINUX /* These errno mapping are specific to Linux. For more informatio= n: - * - scsi_decide_disposition in drivers/scsi/scsi_error.c + * - scsi_check_sense and scsi_decide_disposition in drivers/scsi/= scsi_error.c * - scsi_result_to_blk_status in drivers/scsi/scsi_lib.c * - blk_errors[] in block/blk-core.c */ @@ -599,7 +599,7 @@ int scsi_sense_from_errno(int errno_value, SCSISense *s= ense) *sense =3D SENSE_CODE(READ_ERROR); return CHECK_CONDITION; case EREMOTEIO: - *sense =3D SENSE_CODE(LUN_COMM_FAILURE); + *sense =3D SENSE_CODE(TARGET_FAILURE); return CHECK_CONDITION; #endif case ENOMEDIUM: --=20 2.26.2 From nobody Mon Feb 9 00:46:14 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615929727; cv=none; d=zohomail.com; s=zohoarc; b=HBhxBERPWMttwEBJy176XRn2Yy+4ccqA67rViWQMl8asYR64TiFDIOLDdhX1zGVLNxCIeQCnlS4IXOhFwIyqwXOqy7lx6vPGZ+6pYenE4nUSX8HVHbeBVrx4FSPuNhdAeASO7Imhj84dPnp9xx3kJSa0R8kNyXiY5H80ZQfekZg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615929727; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jh8sn3aqQA2d6yGp+dL+fOy2B9FyyZ4ULlc68iipLb0=; b=Hcvqpv4lw5O71TSEWQ6E3mj4sEzOdbSh9KFh7QpDgBeEGoyvVHEqO/aaeE++jlGNWgKdWK5ZMN06Qp3YmusFnHXaxLpOU+GKO0iQQYkW0LN3pg9fD6Eac0CstSiW8dlvnk/zfpt5pHQOTSLXRwefqzq+9YVO7vbkVHQ/s+z42ec= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615929727419785.8932041347776; Tue, 16 Mar 2021 14:22:07 -0700 (PDT) Received: from localhost ([::1]:57438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMH8g-0005wb-Ay for importer@patchew.org; Tue, 16 Mar 2021 17:22:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2k-0005kQ-KQ for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:24210) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMH2e-0003Xd-UY for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:58 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-312-ke5x-UPlMheJm7BmPn8JHQ-1; Tue, 16 Mar 2021 17:15:50 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D46E387A82A; Tue, 16 Mar 2021 21:15:48 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 844B1610AF; Tue, 16 Mar 2021 21:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929352; h=from:from:reply-to:subject:subject: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=jh8sn3aqQA2d6yGp+dL+fOy2B9FyyZ4ULlc68iipLb0=; b=eE9ytzdRwP/bQMm6BtVDXf7MjwK7xUyZcYKveIDMjZk/vbuwSWQfG/JL3VQRAQCQciGKOD mjC4Fg2uBao004O4fRPUL3YGjtz74yqTSy+ozpiZbNs+GoQmY2Eds+PwYSWypF9sP+fyjt 2Pth7QpX2QxVqLz6RE7XiuqzIYjvHLU= X-MC-Unique: ke5x-UPlMheJm7BmPn8JHQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 15/16] hw/i8254: fix vmstate load Date: Tue, 16 Mar 2021 17:15:30 -0400 Message-Id: <20210316211531.1649909-16-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk QEMU timer of channel 0 in i8254 is used to raise irq at the specified moment of time. This irq can be disabled with irq_disabled flag. But when vmstate of the pit is loaded, timer may be rearmed despite the disabled interrupts. This patch adds irq_disabled flag check to fix that. Signed-off-by: Pavel Dovgalyuk Message-Id: <161537170060.6654.9430112746749476215.stgit@pasha-ThinkPad-X28= 0> Signed-off-by: Paolo Bonzini --- hw/timer/i8254.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/timer/i8254.c b/hw/timer/i8254.c index c01ee2c72a..c8388ea432 100644 --- a/hw/timer/i8254.c +++ b/hw/timer/i8254.c @@ -324,7 +324,7 @@ static void pit_post_load(PITCommonState *s) { PITChannelState *sc =3D &s->channels[0]; =20 - if (sc->next_transition_time !=3D -1) { + if (sc->next_transition_time !=3D -1 && !sc->irq_disabled) { timer_mod(sc->irq_timer, sc->next_transition_time); } else { timer_del(sc->irq_timer); --=20 2.26.2 From nobody Mon Feb 9 00:46:14 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615929880; cv=none; d=zohomail.com; s=zohoarc; b=PzjkD5X/zDpxjgacF8ZV4EmFB4s6gxuU0K5vE3BQxlrc7fC5/RdIarpolyUN8D3Op9pXQF8/gLowfR60rl02JzufwScfZO0Q7mkE7zxnfccr0+Cpbk8DctVC6aD8Mdk640gufN/c0kV+qOvMe8YWivu5+UmcijHWKDYmbGStGF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615929880; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EZtJYDQX+XcSW7/XY3Jkdf8eH7R1x9pqkUBgdJY7Deg=; b=iiUA3u3HCxrC2FvzD1qo0l8lHuvEZfAqdhlO43Rzjmjx0UwLkdQhnneTcZkMpw0bKkixC9ECjhde2lcRQF+EMGgAFO5O4wlFDW0oHPimA4/75aH6B6mHUfebwvgW+qp7/AtTpQaSWlbKa8l6sE4c3FHVxCD/etri6s898O79VRI= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615929880146478.1062589000437; Tue, 16 Mar 2021 14:24:40 -0700 (PDT) Received: from localhost ([::1]:37154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMHB9-0000pa-65 for importer@patchew.org; Tue, 16 Mar 2021 17:24:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMH2k-0005jZ-9I for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:36748) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lMH2e-0003Xb-PI for qemu-devel@nongnu.org; Tue, 16 Mar 2021 17:15:58 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-312-nqx6CsSrM3SuHryG2Jvf5w-1; Tue, 16 Mar 2021 17:15:50 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3B9B9100C61B for ; Tue, 16 Mar 2021 21:15:49 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE4A91378D; Tue, 16 Mar 2021 21:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615929352; h=from:from:reply-to:subject:subject: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=EZtJYDQX+XcSW7/XY3Jkdf8eH7R1x9pqkUBgdJY7Deg=; b=f+ijuGCyUorJspoTeQIjRtqSpoHNDbrvIQVfdjKFe7kIFJDejgv9gl2UcHD/2ZQryMM81P FfebFii3tzr5fyQ6NE6YZVbFQCZKtvsKh6iv3dTNUFt1Bo7mKUTVPga6v37zn+ncHTElP7 /hd0Ow/uG5tee79H1h+xymX3WV7FGVU= X-MC-Unique: nqx6CsSrM3SuHryG2Jvf5w-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 16/16] qemu-timer: allow freeing a NULL timer Date: Tue, 16 Mar 2021 17:15:31 -0400 Message-Id: <20210316211531.1649909-17-pbonzini@redhat.com> In-Reply-To: <20210316211531.1649909-1-pbonzini@redhat.com> References: <20210316211531.1649909-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.25, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Since 5f8e93c3e2 ("util/qemu-timer: Make timer_free() imply timer_del()", 2= 021-01-08) it is not possible anymore to pass a NULL pointer to timer_free(). Previou= sly it would do nothing as it would simply pass NULL down to g_free(). Rectify this, which also fixes "-chardev braille" when there is no device. Reported-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- include/qemu/timer.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 5e76e3f8c2..301fa47b42 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -629,8 +629,10 @@ void timer_del(QEMUTimer *ts); */ static inline void timer_free(QEMUTimer *ts) { - timer_del(ts); - g_free(ts); + if (ts) { + timer_del(ts); + g_free(ts); + } } =20 /** --=20 2.26.2