orion / rpms / qemu

Forked from rpms/qemu 4 years ago
Clone
59eb7ad
From: "Daniel P. Berrange" <berrange@redhat.com>
59eb7ad
Date: Mon, 9 Oct 2017 14:43:42 +0100
59eb7ad
Subject: [PATCH] io: monitor encoutput buffer size from websocket GSource
59eb7ad
59eb7ad
The websocket GSource is monitoring the size of the rawoutput
59eb7ad
buffer to determine if the channel can accepts more writes.
59eb7ad
The rawoutput buffer, however, is merely a temporary staging
59eb7ad
buffer before data is copied into the encoutput buffer. Thus
59eb7ad
its size will always be zero when the GSource runs.
59eb7ad
59eb7ad
This flaw causes the encoutput buffer to grow without bound
59eb7ad
if the other end of the underlying data channel doesn't
59eb7ad
read data being sent. This can be seen with VNC if a client
59eb7ad
is on a slow WAN link and the guest OS is sending many screen
59eb7ad
updates. A malicious VNC client can act like it is on a slow
59eb7ad
link by playing a video in the guest and then reading data
59eb7ad
very slowly, causing QEMU host memory to expand arbitrarily.
59eb7ad
59eb7ad
This issue is assigned CVE-2017-15268, publically reported in
59eb7ad
59eb7ad
  https://bugs.launchpad.net/qemu/+bug/1718964
59eb7ad
59eb7ad
Reviewed-by: Eric Blake <eblake@redhat.com>
59eb7ad
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
59eb7ad
(cherry picked from commit a7b20a8efa28e5f22c26c06cd06c2f12bc863493)
59eb7ad
---
59eb7ad
 io/channel-websock.c | 4 ++--
59eb7ad
 1 file changed, 2 insertions(+), 2 deletions(-)
59eb7ad
59eb7ad
diff --git a/io/channel-websock.c b/io/channel-websock.c
59eb7ad
index 5a3badbec2..c02c2a66c9 100644
59eb7ad
--- a/io/channel-websock.c
59eb7ad
+++ b/io/channel-websock.c
59eb7ad
@@ -26,7 +26,7 @@
59eb7ad
 #include "trace.h"
59eb7ad
 
59eb7ad
 
59eb7ad
-/* Max amount to allow in rawinput/rawoutput buffers */
59eb7ad
+/* Max amount to allow in rawinput/encoutput buffers */
59eb7ad
 #define QIO_CHANNEL_WEBSOCK_MAX_BUFFER 8192
59eb7ad
 
59eb7ad
 #define QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN 24
59eb7ad
@@ -1006,7 +1006,7 @@ qio_channel_websock_source_prepare(GSource *source,
59eb7ad
     if (wsource->wioc->rawinput.offset) {
59eb7ad
         cond |= G_IO_IN;
59eb7ad
     }
59eb7ad
-    if (wsource->wioc->rawoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
59eb7ad
+    if (wsource->wioc->encoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
59eb7ad
         cond |= G_IO_OUT;
59eb7ad
     }
59eb7ad