From: Eric Blake <eblake@redhat.com>
To: P J P <ppandit@redhat.com>, Qemu Developers <qemu-devel@nongnu.org>
Cc: Li Qiang <liqiang6-s@360.cn>,
Prasad J Pandit <pjp@fedoraproject.org>,
Stefan Hajnoczi <stefanha@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] virtio: check vring descriptor buffer length
Date: Wed, 27 Jul 2016 10:13:04 -0600 [thread overview]
Message-ID: <5798DD90.1050309@redhat.com> (raw)
In-Reply-To: <1469633876-23209-1-git-send-email-ppandit@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]
On 07/27/2016 09:37 AM, P J P wrote:
> From: Prasad J Pandit <pjp@fedoraproject.org>
>
> virtio back end uses set of buffers to facilitate I/O operations.
> An infinite loop unfolds in virtqueue_pop() if a buffer was
> of zero size. Add check to avoid it.
>
> Reported-by: Li Qiang <liqiang6-s@360.cn>
> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
> ---
> hw/virtio/virtio.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index 30ede3d..8de896c 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -457,6 +457,11 @@ static void virtqueue_map_desc(unsigned int *p_num_sg, hwaddr *addr, struct iove
> unsigned num_sg = *p_num_sg;
> assert(num_sg <= max_num_sg);
>
> + if (!sz) {
> + error_report("virtio: zero sized buffers are not allowed");
> + exit(1);
> + }
This lets the guest forcefully exit qemu. Isn't it better to just make
the guest error degrade the virtio device into a broken state (the guest
can no longer use it, but qemu doesn't exit)?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2016-07-27 16:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-27 15:37 [Qemu-devel] [PATCH] virtio: check vring descriptor buffer length P J P
2016-07-27 16:13 ` Eric Blake [this message]
2016-07-27 18:11 ` Michael S. Tsirkin
2016-07-28 8:34 ` Stefan Hajnoczi
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=5798DD90.1050309@redhat.com \
--to=eblake@redhat.com \
--cc=liqiang6-s@360.cn \
--cc=mst@redhat.com \
--cc=pjp@fedoraproject.org \
--cc=ppandit@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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 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).