All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>, Fam Zheng <fam@euphon.net>,
	Hannes Reinecke <hare@suse.com>,
	qemu-block@nongnu.org, Li Qiang <liq3ea@163.com>,
	Alexander Bulekov <alxndr@bu.edu>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v2 3/4] tests/qtest/fuzz-test: Add test_megasas_cdb_len_zero() reproducer
Date: Wed, 2 Dec 2020 06:40:14 +0100	[thread overview]
Message-ID: <53023705-a66c-8c9c-c18a-9af08d5a9a7f@redhat.com> (raw)
In-Reply-To: <20201201191026.4149955-4-philmd@redhat.com>

On 01/12/2020 20.10, Philippe Mathieu-Daudé wrote:
> Add a reproducer which triggers (without the previous patch):
> 
>   $ make check-qtest-x86_64
>   Running test qtest-x86_64/fuzz-test
>   qemu-system-x86_64: hw/scsi/megasas.c:1679: megasas_handle_scsi: Assertion `cdb_len > 0 && scsi_cdb_length(cdb) <= cdb_len' failed.
>   tests/qtest/libqtest.c:181: kill_qemu() detected QEMU death from signal 6 (Aborted) (core dumped)
>   ERROR qtest-x86_64/fuzz-test - too few tests run (expected 1, got 0)
> 
> Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/qtest/fuzz-test.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/tests/qtest/fuzz-test.c b/tests/qtest/fuzz-test.c
> index 87b72307a5b..31f90cfb4fc 100644
> --- a/tests/qtest/fuzz-test.c
> +++ b/tests/qtest/fuzz-test.c
> @@ -48,6 +48,23 @@ static void test_lp1878642_pci_bus_get_irq_level_assert(void)
>      qtest_quit(s);
>  }
>  
> +static void test_megasas_cdb_len_zero(void)
> +{
> +    QTestState *s;
> +
> +    s = qtest_init("-M pc -nodefaults "
> +                   "-device megasas-gen2 -device scsi-cd,drive=null0 "
> +                   "-blockdev driver=null-co,read-zeroes=on,node-name=null0");
> +
> +    qtest_outl(s, 0xcf8, 0x80001011);
> +    qtest_outb(s, 0xcfc, 0xbb);
> +    qtest_outl(s, 0xcf8, 0x80001002);
> +    qtest_outl(s, 0xcfc, 0xf3ff2966);
> +    qtest_writeb(s, 0x4600, 0x03);
> +    qtest_outw(s, 0xbb40, 0x460b);
> +    qtest_quit(s);
> +}
> +
>  int main(int argc, char **argv)
>  {
>      const char *arch = qtest_get_arch();
> @@ -59,6 +76,8 @@ int main(int argc, char **argv)
>                         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_megasas_cdb_len_zero",
> +                       test_megasas_cdb_len_zero);
>      }
>  
>      return g_test_run();
> 

Acked-by: Thomas Huth <thuth@redhat.com>



  parent reply	other threads:[~2020-12-02  5:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 19:10 [PATCH v2 0/4] hw/scsi/megasas: Avoid buffer overrun in megasas_handle_scsi() Philippe Mathieu-Daudé
2020-12-01 19:10 ` [PATCH v2 1/4] tests/qtest/fuzz-test: Quit test_lp1878642 once done Philippe Mathieu-Daudé
2020-12-03 10:47   ` Li Qiang
2020-12-01 19:10 ` [PATCH v2 2/4] hw/scsi/megasas: Assert cdb_len is valid in megasas_handle_scsi() Philippe Mathieu-Daudé
2020-12-03 11:21   ` Li Qiang
2020-12-03 11:36     ` Philippe Mathieu-Daudé
2020-12-03 12:02       ` Li Qiang
2020-12-03 12:38         ` Philippe Mathieu-Daudé
2020-12-04  4:50           ` Li Qiang
2020-12-01 19:10 ` [PATCH v2 3/4] tests/qtest/fuzz-test: Add test_megasas_cdb_len_zero() reproducer Philippe Mathieu-Daudé
2020-12-01 19:12   ` Philippe Mathieu-Daudé
2020-12-02  5:40   ` Thomas Huth [this message]
2020-12-01 19:10 ` [RFC PATCH v2 4/4] hw/scsi/megasas: Have incorrect cdb return MFI_STAT_ABORT_NOT_POSSIBLE Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53023705-a66c-8c9c-c18a-9af08d5a9a7f@redhat.com \
    --to=thuth@redhat.com \
    --cc=alxndr@bu.edu \
    --cc=fam@euphon.net \
    --cc=hare@suse.com \
    --cc=liq3ea@163.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.