From nobody Mon Feb 9 22:03:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1637352717; cv=none; d=zohomail.com; s=zohoarc; b=UpZK6s5JGRxvAoxgI2ptlLHSfHDlQgQhpijfRpBRczw3QK1HuQacbRycAHlK01TlcA1mtgZLH4V3i/CtzOpf175m2WWa79pj3D899x8YcylbxFVKErKy8iQ2JfNm/4XZORhdhGsX9efIxuQWQs+TewWMdDR+seOFStUIlF5pwZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637352717; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=0Gq6HjzogQNFDfIqJXgnhwFRKV1Nym1r+WR9nIUiBJQ=; b=aUnpA4NSA54UiINNZbMCAYPed2joaJwucw2JOoCZt4mIESXlpV49+GMbDibFxAh15aIQDWm7PLu0eoetHh6tDX1P2d9+bv6Wwgr7+M0YaElCZb3i8mLcExlarceh83XtV65LioI13ImsO5WwVS35HWdS5aPjqSPKt/yPJxv7OCI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 163735271738056.02238053127917; Fri, 19 Nov 2021 12:11:57 -0800 (PST) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-222-kDs0kXyXOjKlvwx97ZLtAQ-1; Fri, 19 Nov 2021 15:11:54 -0500 Received: by mail-wm1-f71.google.com with SMTP id r129-20020a1c4487000000b00333629ed22dso6423721wma.6 for ; Fri, 19 Nov 2021 12:11:54 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id e12sm937189wrq.20.2021.11.19.12.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 12:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637352716; 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=0Gq6HjzogQNFDfIqJXgnhwFRKV1Nym1r+WR9nIUiBJQ=; b=AKLtLROLWNJC8eNekTUSR+KjiuafqHf60GnD2silcG6QYoGhbDnqeMEccIihxkx+NNYbza g/J935lTH/dZyRTitotY7zsIJ6jWefTybpL/Voh/1yzcttgTw17BAR+Hy1zx8lTdd26rcb ZpI2dpFP5YUL2e04LyHdk1greeVryQw= X-MC-Unique: kDs0kXyXOjKlvwx97ZLtAQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0Gq6HjzogQNFDfIqJXgnhwFRKV1Nym1r+WR9nIUiBJQ=; b=gVAoisoBEDGOHdPzQEqWkeyTq6kkcSA03wbSFVREee47/zuvGVQhZ5Wii4bSdNHcvC IbaVqvOERfC0GNjHWoAtx2zneWjR6rpw1CVtabLphMG7jN3qQtuS7p8wIdwkl/Ppt3be pNlc2Ire2p9RYSF2KUzrz3VSpTzvdSAxn5griy3m1esHHg0DHSeHx5gQRMd/Ooi5cK6Q BFyWb5fqa8ONAbzFwdydzM9QkO+cndFWKRk7MtdxqoU4dzfrIDg638+bHyUt+PIF+hOn 25+L7on0YYNVT47bqx73zUKVahEyYri7v8aJu5JJJAC5/fFR3HWE8pi3hK5CBCD+55Im DQbw== X-Gm-Message-State: AOAM530YMEH5mc9qHXWSvkE69lXbOL7Bc1cqAuYBBxoKiLzOZ6O35YNK Ngl/nG4DqkFV5E/yv1sSWNGepbkSvyJxeoaczTZuS1jsw6ASqaoB7n90oO9h39yI+pgx2ZlHycp VW+jImGtosCcjlQ== X-Received: by 2002:a05:600c:1d28:: with SMTP id l40mr2998138wms.192.1637352713652; Fri, 19 Nov 2021 12:11:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2DR61AiYTQSjxr7lCwpna4EFDXr4+2H7nfm6nlE4D0DPmRfDoyyW44n+WUc/VzfHX/4rmSg== X-Received: by 2002:a05:600c:1d28:: with SMTP id l40mr2998101wms.192.1637352713491; Fri, 19 Nov 2021 12:11:53 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Bandan Das , Thomas Huth , Darren Kenny , Fam Zheng , Alexander Bulekov , Paolo Bonzini , Laurent Vivier , Stefan Hajnoczi , Qiuhao Li , qemu-block@nongnu.org, Hannes Reinecke , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-6.2 2/2] tests/qtest/fuzz-megasas-test: Add test for GitLab issue #521 Date: Fri, 19 Nov 2021 21:11:41 +0100 Message-Id: <20211119201141.532377-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211119201141.532377-1-philmd@redhat.com> References: <20211119201141.532377-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) X-ZM-MESSAGEID: 1637352718313100001 Without the previous commit, this test triggers: $ make check-qtest-x86_64 [...] Running test qtest-x86_64/fuzz-megasas-test qemu-system-x86_64: softmmu/physmem.c:3229: address_space_unmap: Assertio= n `mr !=3D NULL' failed. Broken pipe ERROR qtest-x86_64/fuzz-megasas-test - too few tests run (expected 2, got= 1) Suggested-by: Alexander Bulekov Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/qtest/fuzz-megasas-test.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/qtest/fuzz-megasas-test.c b/tests/qtest/fuzz-megasas-tes= t.c index 940a76bf25a..e1141c58a4e 100644 --- a/tests/qtest/fuzz-megasas-test.c +++ b/tests/qtest/fuzz-megasas-test.c @@ -34,6 +34,34 @@ static void test_lp1878263_megasas_zero_iov_cnt(void) qtest_quit(s); } =20 +/* + * Overflow SGL buffer. + * https://gitlab.com/qemu-project/qemu/-/issues/521 + */ +static void test_gitlab_issue521_megasas_sgl_ovf(void) +{ + QTestState *s =3D qtest_init("-display none -m 32M -machine q35 " + "-nodefaults -device megasas " + "-device scsi-cd,drive=3Dnull0 " + "-blockdev " + "driver=3Dnull-co,read-zeroes=3Don,node-nam= e=3Dnull0"); + qtest_outl(s, 0xcf8, 0x80000818); + qtest_outl(s, 0xcfc, 0xc000); + qtest_outl(s, 0xcf8, 0x80000804); + qtest_outw(s, 0xcfc, 0x05); + qtest_bufwrite(s, 0x0, "\x01", 0x1); + qtest_bufwrite(s, 0x7, "\x01", 0x1); + qtest_bufwrite(s, 0x10, "\x02", 0x1); + qtest_bufwrite(s, 0x16, "\x01", 0x1); + qtest_bufwrite(s, 0x28, "\x01", 0x1); + qtest_bufwrite(s, 0x33, "\x01", 0x1); + qtest_outb(s, 0xc040, 0x0); + qtest_outb(s, 0xc040, 0x20); + qtest_outl(s, 0xc040, 0x20000000); + qtest_outb(s, 0xc040, 0x20); + qtest_quit(s); +} + int main(int argc, char **argv) { const char *arch =3D qtest_get_arch(); @@ -43,6 +71,8 @@ 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_lp1878263_megasas_zero_iov_cnt", test_lp1878263_megasas_zero_iov_cnt); + qtest_add_func("fuzz/gitlab_issue521_megasas_sgl_ovf", + test_gitlab_issue521_megasas_sgl_ovf); } =20 return g_test_run(); --=20 2.31.1