* [Qemu-devel] [PATCH V2] virtio: validate the existence of handle_output before calling it
@ 2015-03-12 9:50 Jason Wang
2015-03-12 14:15 ` Don Koch
2015-03-13 3:03 ` [Qemu-devel] [Qemu-stable] " Fam Zheng
0 siblings, 2 replies; 3+ messages in thread
From: Jason Wang @ 2015-03-12 9:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Jason Wang, qemu-stable, dkoch, Michael S. Tsirkin
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>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH V2] virtio: validate the existence of handle_output before calling it
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 ` [Qemu-devel] [Qemu-stable] " Fam Zheng
1 sibling, 0 replies; 3+ messages in thread
From: Don Koch @ 2015-03-12 14:15 UTC (permalink / raw)
To: Jason Wang; +Cc: Michael S. Tsirkin, qemu-devel, qemu-stable
On Thu, 12 Mar 2015 17:50:18 +0800
Jason Wang <jasowang@redhat.com> 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: Don Koch <dkoch@verizon.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
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [Qemu-stable] [PATCH V2] virtio: validate the existence of handle_output before calling it
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
1 sibling, 0 replies; 3+ messages in thread
From: Fam Zheng @ 2015-03-13 3:03 UTC (permalink / raw)
To: Jason Wang; +Cc: Michael S. Tsirkin, qemu-devel, dkoch, qemu-stable
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
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-13 3:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [Qemu-devel] [Qemu-stable] " Fam Zheng
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.