From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, Zheyu Ma <zheyuma97@gmail.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Eric Auger <eric.auger@redhat.com>
Subject: Re: [PATCH v1] virtio-iommu: add error check before assert
Date: Tue, 11 Jun 2024 20:46:55 +0300 [thread overview]
Message-ID: <CAAjaMXZb+9h+eMOE67k-tGNRSObFqD5-_wUT1PaOHWSE86b2Aw@mail.gmail.com> (raw)
In-Reply-To: <5cc8bab3-4edc-4657-882b-5e8291fba29d@linaro.org>
On Tue, 11 Jun 2024 at 18:01, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> On 11/6/24 14:23, Manos Pitsidianakis wrote:
> > A fuzzer case discovered by Zheyu Ma causes an assert failure.
> >
> > Add a check before the assert, and respond with an error before moving
> > on to the next queue element.
> >
> > To reproduce the failure:
> >
> > cat << EOF | \
> > qemu-system-x86_64 \
> > -display none -machine accel=qtest -m 512M -machine q35 -nodefaults \
> > -device virtio-iommu -qtest stdio
> > outl 0xcf8 0x80000804
> > outw 0xcfc 0x06
> > outl 0xcf8 0x80000820
> > outl 0xcfc 0xe0004000
> > write 0x10000e 0x1 0x01
> > write 0xe0004020 0x4 0x00001000
> > write 0xe0004028 0x4 0x00101000
> > write 0xe000401c 0x1 0x01
> > write 0x106000 0x1 0x05
> > write 0x100001 0x1 0x60
> > write 0x100002 0x1 0x10
> > write 0x100009 0x1 0x04
> > write 0x10000c 0x1 0x01
> > write 0x100018 0x1 0x04
> > write 0x10001c 0x1 0x02
> > write 0x101003 0x1 0x01
> > write 0xe0007001 0x1 0x00
> > EOF
> >
> > Reported-by: Zheyu Ma <zheyuma97@gmail.com>
> > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2359
> > Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> > ---
> > hw/virtio/virtio-iommu.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c
> > index 1326c6ec41..9b99def39f 100644
> > --- a/hw/virtio/virtio-iommu.c
> > +++ b/hw/virtio/virtio-iommu.c
> > @@ -818,6 +818,18 @@ static void virtio_iommu_handle_command(VirtIODevice *vdev, VirtQueue *vq)
> > out:
> > sz = iov_from_buf(elem->in_sg, elem->in_num, 0,
> > buf ? buf : &tail, output_size);
> > + if (unlikely(sz != output_size)) {
>
> Is this a normal guest behavior? Should we log it as GUEST_ERROR?
It's not, it'd be a virtio spec (implementation) mis-use by the guest.
the Internal device error (VIRTIO_IOMMU_S_DEVERR) would be logged by
the kernel; should we log it as well?
next prev parent reply other threads:[~2024-06-11 17:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-11 12:23 [PATCH v1] virtio-iommu: add error check before assert Manos Pitsidianakis
2024-06-11 15:01 ` Philippe Mathieu-Daudé
2024-06-11 17:46 ` Manos Pitsidianakis [this message]
2024-06-12 8:56 ` Alex Bennée
2024-06-13 5:27 ` Manos Pitsidianakis
2024-06-12 9:46 ` Alex Bennée
2024-06-13 5:20 ` Manos Pitsidianakis
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=CAAjaMXZb+9h+eMOE67k-tGNRSObFqD5-_wUT1PaOHWSE86b2Aw@mail.gmail.com \
--to=manos.pitsidianakis@linaro.org \
--cc=eric.auger@redhat.com \
--cc=mst@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=zheyuma97@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).