From: Fam Zheng <famz@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
qemu-devel@nongnu.org, dkoch@verizon.com, qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-stable] [PATCH V2] virtio: validate the existence of handle_output before calling it
Date: Fri, 13 Mar 2015 11:03:02 +0800 [thread overview]
Message-ID: <20150313030302.GA23717@ad.nay.redhat.com> (raw)
In-Reply-To: <1426153818-28804-1-git-send-email-jasowang@redhat.com>
On Thu, 03/12 17:50, Jason Wang wrote:
> We don't validate the existence of handle_output which may let a buggy
> guest to trigger a SIGSEV easily. E.g:
>
> 1) write 10 to queue_sel to a virtio net device with only 1 queue
> 2) setup an arbitrary pfn
> 3) then notify queue 10
>
> Fixing this by validating the existence of handle_output before.
>
> Cc: qemu-stable@nongnu.org
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
> ---
> Changes from V1:
> - check the existence of both vring.desc and handle_output in the same
> line
> - describe the reproducer in the commit log
> ---
> hw/virtio/virtio.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index 3c6e430..17c1260 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -759,8 +759,9 @@ void virtio_queue_set_align(VirtIODevice *vdev, int n, int align)
>
> void virtio_queue_notify_vq(VirtQueue *vq)
> {
> - if (vq->vring.desc) {
> + if (vq->vring.desc && vq->handle_output) {
> VirtIODevice *vdev = vq->vdev;
> +
> trace_virtio_queue_notify(vdev, vq - vdev->vq, vq);
> vq->handle_output(vdev, vq);
> }
> --
> 2.1.0
>
>
prev parent reply other threads:[~2015-03-13 3:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-12 9:50 [Qemu-devel] [PATCH V2] virtio: validate the existence of handle_output before calling it Jason Wang
2015-03-12 14:15 ` Don Koch
2015-03-13 3:03 ` Fam Zheng [this message]
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=20150313030302.GA23717@ad.nay.redhat.com \
--to=famz@redhat.com \
--cc=dkoch@verizon.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@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 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).