From: Laurent Vivier <lvivier@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>, "Thomas Huth" <thuth@redhat.com>,
"Alexander Bulekov" <alxndr@bu.edu>,
"Cheolwoo Myung" <cwmyung@snu.ac.kr>,
"Qiuhao Li" <Qiuhao.Li@outlook.com>,
qemu-stable@nongnu.org, Ruhr-University <bugs-syssec@rub.de>,
"Darren Kenny" <darren.kenny@oracle.com>,
"Bandan Das" <bsd@redhat.com>,
"Jérôme Poulin" <jeromepoulin@gmail.com>,
"Vadim Rozenfeld" <vrozenfe@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Gaoning Pan" <pgn@zju.edu.cn>,
"Gerd Hoffmann" <kraxel@redhat.com>
Subject: Re: [PATCH-for-6.2 1/2] hw/scsi/lsi53c895a: Do not abort when DMA requested and no data queued
Date: Tue, 23 Nov 2021 12:26:01 +0100 [thread overview]
Message-ID: <7cf21573-2116-e19b-e6ef-906830f1694f@redhat.com> (raw)
In-Reply-To: <20211123111732.83137-2-philmd@redhat.com>
On 23/11/2021 12:17, Philippe Mathieu-Daudé wrote:
> If asked for DMA request and no data is available, simply wait
> for data to be queued, do not abort. This fixes:
>
> $ cat << EOF | \
> qemu-system-i386 -nographic -M q35,accel=qtest -serial none \
> -monitor none -qtest stdio -trace lsi* \
> -drive if=none,id=drive0,file=null-co://,file.read-zeroes=on,format=raw \
> -device lsi53c895a,id=scsi0 -device scsi-hd,drive=drive0,bus=scsi0.0,channel=0,scsi-id=0,lun=0
> lsi_reset Reset
> lsi_reg_write Write reg DSP2 0x2e = 0xff
> lsi_reg_write Write reg DSP3 0x2f = 0xff
> lsi_execute_script SCRIPTS dsp=0xffff0000 opcode 0x184a3900 arg 0x4a8b2d75
> qemu-system-i386: hw/scsi/lsi53c895a.c:624: lsi_do_dma: Assertion `s->current' failed.
>
> (gdb) bt
> #5 0x00007ffff4e8a3a6 in __GI___assert_fail
> (assertion=0x5555560accbc "s->current", file=0x5555560acc28 "hw/scsi/lsi53c895a.c", line=624, function=0x5555560adb18 "lsi_do_dma") at assert.c:101
> #6 0x0000555555aa33b9 in lsi_do_dma (s=0x555557805ac0, out=1) at hw/scsi/lsi53c895a.c:624
> #7 0x0000555555aa5042 in lsi_execute_script (s=0x555557805ac0) at hw/scsi/lsi53c895a.c:1250
> #8 0x0000555555aa757a in lsi_reg_writeb (s=0x555557805ac0, offset=47, val=255 '\377') at hw/scsi/lsi53c895a.c:1984
> #9 0x0000555555aa875b in lsi_mmio_write (opaque=0x555557805ac0, addr=47, val=255, size=1) at hw/scsi/lsi53c895a.c:2095
>
> Cc: qemu-stable@nongnu.org
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Vadim Rozenfeld <vrozenfe@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Reported-by: Jérôme Poulin <jeromepoulin@gmail.com>
> Reported-by: Ruhr-University <bugs-syssec@rub.de>
> Reported-by: Gaoning Pan <pgn@zju.edu.cn>
> Reported-by: Cheolwoo Myung <cwmyung@snu.ac.kr>
> Fixes: b96a0da06bd ("lsi: move dma_len+dma_buf into lsi_request")
> BugLink: https://bugs.launchpad.net/qemu/+bug/697510
> BugLink: https://bugs.launchpad.net/qemu/+bug/1905521
> BugLink: https://bugs.launchpad.net/qemu/+bug/1908515
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/84
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/305
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/552
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/scsi/lsi53c895a.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
> index 85e907a7854..4c431adb774 100644
> --- a/hw/scsi/lsi53c895a.c
> +++ b/hw/scsi/lsi53c895a.c
> @@ -621,8 +621,7 @@ static void lsi_do_dma(LSIState *s, int out)
> dma_addr_t addr;
> SCSIDevice *dev;
>
> - assert(s->current);
> - if (!s->current->dma_len) {
> + if (!s->current || !s->current->dma_len) {
> /* Wait until data is available. */
> trace_lsi_do_dma_unavailable();
> return;
>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
next prev parent reply other threads:[~2021-11-23 11:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-23 11:17 [PATCH-for-6.2 0/2] hw/scsi/lsi53c895a: Fix guest-triggerable assert() in lsi_do_dma() Philippe Mathieu-Daudé
2021-11-23 11:17 ` [PATCH-for-6.2 1/2] hw/scsi/lsi53c895a: Do not abort when DMA requested and no data queued Philippe Mathieu-Daudé
2021-11-23 11:26 ` Laurent Vivier [this message]
2021-11-23 11:17 ` [PATCH-for-6.2 2/2] tests/qtest: Add fuzz-lsi53c895a-test Philippe Mathieu-Daudé
2021-11-23 11:32 ` Laurent Vivier
2021-11-23 14:02 ` [PATCH-for-6.2 0/2] hw/scsi/lsi53c895a: Fix guest-triggerable assert() in lsi_do_dma() Paolo Bonzini
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=7cf21573-2116-e19b-e6ef-906830f1694f@redhat.com \
--to=lvivier@redhat.com \
--cc=Qiuhao.Li@outlook.com \
--cc=alxndr@bu.edu \
--cc=bsd@redhat.com \
--cc=bugs-syssec@rub.de \
--cc=cwmyung@snu.ac.kr \
--cc=darren.kenny@oracle.com \
--cc=fam@euphon.net \
--cc=jeromepoulin@gmail.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pgn@zju.edu.cn \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
--cc=vrozenfe@redhat.com \
/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.