public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Doug Goldstein" <cardoe@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/qemu-kvm:qemu-kvm-0.14.1-gentoo commit in: hw/
Date: Thu, 21 Jul 2011 20:22:57 +0000 (UTC)	[thread overview]
Message-ID: <35e17b6a41b1d1126f7f68b835b227805404440d.cardoe@gentoo> (raw)

commit:     35e17b6a41b1d1126f7f68b835b227805404440d
Author:     Nelson Elhage <&lt;nelhage <AT> ksplice <DOT> com&gt>
AuthorDate: Thu May 19 17:23:17 2011 +0000
Commit:     Doug Goldstein <cardoe <AT> gentoo <DOT> org>
CommitDate: Thu Jul 21 20:22:39 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/qemu-kvm.git;a=commit;h=35e17b6a

virtqueue: Sanity-check the length of indirect descriptors.

We were previously allowing arbitrarily-long descriptors, which could lead to a
buffer overflow in the qemu-kvm process.

---
 hw/virtio.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/hw/virtio.c b/hw/virtio.c
index 31bd9e3..a91a28b 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -336,6 +336,11 @@ int virtqueue_avail_bytes(VirtQueue *vq, int in_bytes, int out_bytes)
             max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc);
             num_bufs = i = 0;
             desc_pa = vring_desc_addr(desc_pa, i);
+
+            if (max &gt; VIRTQUEUE_MAX_SIZE) {
+                error_report(&quot;Too-large indirect descriptor&quot;);
+                exit(1);
+            }
         }
 
         do {
@@ -406,6 +411,11 @@ int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem)
         max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc);
         desc_pa = vring_desc_addr(desc_pa, i);
         i = 0;
+
+        if (max &gt; VIRTQUEUE_MAX_SIZE) {
+            error_report(&quot;Too-large indirect descriptor&quot;);
+            exit(1);
+        }
     }
 
     /* Collect all the descriptors */



             reply	other threads:[~2011-07-21 20:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-21 20:22 Doug Goldstein [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-07-26 17:16 [gentoo-commits] proj/qemu-kvm:qemu-kvm-0.14.1-gentoo commit in: hw/ Doug Goldstein
2011-07-21 20:19 Doug Goldstein
2011-07-21 20:19 Doug Goldstein

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=35e17b6a41b1d1126f7f68b835b227805404440d.cardoe@gentoo \
    --to=cardoe@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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