From nobody Mon Feb 9 18:00:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1611659819; cv=none; d=zohomail.com; s=zohoarc; b=gWT0F4MqbkvuulRzgZiZP2ouZW7ed5GD+kdeGFN+/W+GDYLnNiUURspxHV7X4yOvKcnLThEwVFHeZ/ybItUaQzOuzD5JejQ7p6jNTjMiWB/Cp52T4mOueU/fLRHoEsHnilgzVp0UNIfEyIqKQCLhOhYPFnIjXGsjjviJCrzE25g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611659819; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=6y59I937hE7WeSby5lmZT2/B3vYVu6vqOt5kug2kSA0=; b=XNLvkLXCPFsNBjjRD3Hvt6s0YhX86RLkS58QcMBLjsOneF7GTPcHPZdmNOKwVT038FVQy2D8WzEtOgyb4YZq5hip8rrZEM/8dU3aVpFpee5LYbKlONNHrQNgT7o1s+EmKVZgmF1hzC0aZJqzGHNbSAU9xd8dLcC+St5duAtvteg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1611659819102902.0022008443999; Tue, 26 Jan 2021 03:16:59 -0800 (PST) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-308-eJOJISyNMIupG_YrnaRURQ-1; Tue, 26 Jan 2021 06:16:54 -0500 Received: by mail-ed1-f69.google.com with SMTP id o8so3923320edh.12 for ; Tue, 26 Jan 2021 03:16:54 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (13.red-83-57-169.dynamicip.rima-tde.net. [83.57.169.13]) by smtp.gmail.com with ESMTPSA id x21sm526060eje.118.2021.01.26.03.16.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jan 2021 03:16:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611659818; 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=6y59I937hE7WeSby5lmZT2/B3vYVu6vqOt5kug2kSA0=; b=edHrtA7d+At2Nr+0TVN51xzpBAgfjaXQV+adQd7kGSeouZzGwqIHY9gb4xisyTSDN9/0BU jMZxoGcsx36z9A9d9jEUkR1MyzBdWvszEan16ybS+pSPQObwLOv90sBWf29wm7URaREYCs 1Tta3WdxISkiVnejl+qEobwRQs+N+dc= X-MC-Unique: eJOJISyNMIupG_YrnaRURQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6y59I937hE7WeSby5lmZT2/B3vYVu6vqOt5kug2kSA0=; b=tiLF7Gb4ULnc7ugURch0r2Dh/1PgG3ctcPe8i/HJFczoVsvGS7lW4Jgx1VSqcvHqxN xcY8r04NrdVo84PlZssLM1+FvpI61G95egIBalALQc+3Jui5Z47DMptUflG11Yjz4VfY XMEBDzEg5H5M6fEzEovJPQXrshL5JYJRBlDmSYkqsuIOMzJr5xGAUoVU6ADWLyXrZc7h Nc9FqR66SB6kZwPmTZAYQoixk0C8kOj9ehlBsFpUGz8mUgcAGUgjZT+gZvgp/aDb/BTw 4blOUWkaEaRSPelC28/AhQqHurx5LlYJ26gQ5oZuvWZJXYTGInT0f1dmkgaqcmZfamxh nnSQ== X-Gm-Message-State: AOAM531RD9Wcrsv+l7p9uJAIkSF7OtAeuuwi+N3DpLAWgB8wPLIAcL37 yYRdZOwp/Z9qlSFfJJ1/yl4NIORLgY7hcc+stZSickB/GAyxUmRFREfCB8uxEB6oNvesx/GYvoy colYbCDdHDVr8fA== X-Received: by 2002:aa7:c94c:: with SMTP id h12mr4289314edt.40.1611659813229; Tue, 26 Jan 2021 03:16:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDvIaPKBSY/eFQQGpooa/E16Z3DVFP19bgRXi8IkuWJUM+xxHhANFujGPpl3Ph8jGhIqx8Kg== X-Received: by 2002:aa7:c94c:: with SMTP id h12mr4289297edt.40.1611659813031; Tue, 26 Jan 2021 03:16:53 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Fam Zheng , Hannes Reinecke , qemu-block@nongnu.org, Paolo Bonzini , Thomas Huth , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S . Tsirkin" Subject: [PATCH v2 2/2] tests/qtest: Only run fuzz-virtio-scsi when virtio-scsi is available Date: Tue, 26 Jan 2021 12:16:38 +0100 Message-Id: <20210126111638.3141780-3-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210126111638.3141780-1-philmd@redhat.com> References: <20210126111638.3141780-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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 --- tests/qtest/fuzz-test.c | 51 -------------------- tests/qtest/fuzz-virtio-scsi-test.c | 75 +++++++++++++++++++++++++++++ MAINTAINERS | 1 + 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/tests/qtest/fuzz-test.c b/tests/qtest/fuzz-test.c index 6188fbb8e96..d112798afe3 100644 --- a/tests/qtest/fuzz-test.c +++ b/tests/qtest/fuzz-test.c @@ -25,55 +25,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(); @@ -83,8 +34,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 00000000000..aaf6d10e189 --- /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/MAINTAINERS b/MAINTAINERS index 44cd74b03cd..48c0ec41e93 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1717,6 +1717,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/meson.build b/tests/qtest/meson.build index 85682d0dfce..f2090296597 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -6,6 +6,7 @@ =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