From nobody Fri Oct 24 09:58:53 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518782364027790.0254910940226; Fri, 16 Feb 2018 03:59:24 -0800 (PST) Received: from localhost ([::1]:40620 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emefd-0005QQ-9B for importer@patchew.org; Fri, 16 Feb 2018 06:59:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emeao-0001dO-OO for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emeal-0003fT-Ij for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:18 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38342 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emeal-0003eB-Ct for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:15 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8E98F8185322 for ; Fri, 16 Feb 2018 11:54:11 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-147.ams2.redhat.com [10.36.116.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48A58213AEE4; Fri, 16 Feb 2018 11:54:11 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A87773F78A; Fri, 16 Feb 2018 12:54:10 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 12:54:02 +0100 Message-Id: <20180216115410.27287-2-kraxel@redhat.com> In-Reply-To: <20180216115410.27287-1-kraxel@redhat.com> References: <20180216115410.27287-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 16 Feb 2018 11:54:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 16 Feb 2018 11:54:11 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 1/9] vnc: remove bogus object_unref on client socket X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Daniel P. Berrang=C3=A9 vnc_listen_io() does not own the reference on the 'cioc' parameter is it passed, so should not be unref'ing it. Fixes: 13e1d0e71e78a925848258391a6e616b6b5ae219 Reported-by: Bandan Das Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Message-id: 20180215102602.10864-1-berrange@redhat.com Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/vnc.c b/ui/vnc.c index c715bae1cf..b97769aa9e 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3152,7 +3152,6 @@ static void vnc_listen_io(QIONetListener *listener, isWebsock ? "vnc-ws-server" : "vnc-server"); qio_channel_set_delay(QIO_CHANNEL(cioc), false); vnc_connect(vd, cioc, false, isWebsock); - object_unref(OBJECT(cioc)); } =20 static const DisplayChangeListenerOps dcl_ops =3D { --=20 2.9.3 From nobody Fri Oct 24 09:58:53 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151878219779523.2269331962832; Fri, 16 Feb 2018 03:56:37 -0800 (PST) Received: from localhost ([::1]:40513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emed2-00034V-VS for importer@patchew.org; Fri, 16 Feb 2018 06:56:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emeao-0001dL-Mz for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emeal-0003gB-Lr for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:18 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33708 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emeal-0003eR-Dc for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:15 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EDB734023112 for ; Fri, 16 Feb 2018 11:54:13 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-147.ams2.redhat.com [10.36.116.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47445B3508; Fri, 16 Feb 2018 11:54:11 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B0F6B4F27B; Fri, 16 Feb 2018 12:54:10 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 12:54:03 +0100 Message-Id: <20180216115410.27287-3-kraxel@redhat.com> In-Reply-To: <20180216115410.27287-1-kraxel@redhat.com> References: <20180216115410.27287-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 16 Feb 2018 11:54:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 16 Feb 2018 11:54:13 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 2/9] vnc: add qapi/error.h include to stubs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fixes --disable-vnc build failure. Signed-off-by: Gerd Hoffmann Reviewed-by: Eric Blake Message-id: 20180213070526.22475-1-kraxel@redhat.com --- ui/vnc-stubs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/vnc-stubs.c b/ui/vnc-stubs.c index f51280549a..06c4ac6296 100644 --- a/ui/vnc-stubs.c +++ b/ui/vnc-stubs.c @@ -1,5 +1,6 @@ #include "qemu/osdep.h" #include "ui/console.h" +#include "qapi/error.h" =20 int vnc_display_password(const char *id, const char *password) { --=20 2.9.3 From nobody Fri Oct 24 09:58:53 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518782708593387.6177486728734; Fri, 16 Feb 2018 04:05:08 -0800 (PST) Received: from localhost ([::1]:41229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emelH-0001tA-SO for importer@patchew.org; Fri, 16 Feb 2018 07:05:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emeao-0001dG-ML for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emeal-0003g6-Mm for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:18 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33706 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emeal-0003eH-Cn for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:15 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 87ADD402290A; Fri, 16 Feb 2018 11:54:11 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-147.ams2.redhat.com [10.36.116.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45C09213AEE2; Fri, 16 Feb 2018 11:54:11 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BA35C4F29D; Fri, 16 Feb 2018 12:54:10 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 12:54:04 +0100 Message-Id: <20180216115410.27287-4-kraxel@redhat.com> In-Reply-To: <20180216115410.27287-1-kraxel@redhat.com> References: <20180216115410.27287-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 16 Feb 2018 11:54:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 16 Feb 2018 11:54:11 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 3/9] vnc: fix segfault in closed connection handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Klim Kireev , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Klim Kireev On one of our client's node, due to trying to read from closed ioc, a segmentation fault occured. Corresponding backtrace: 0 object_get_class (obj=3Dobj@entry=3D0x0) 1 qio_channel_readv_full (ioc=3D0x0, iov=3D0x7ffe55277180 ... 2 qio_channel_read (ioc=3D ... 3 vnc_client_read_buf (vs=3Dvs@entry=3D0x55625f3c6000, ... 4 vnc_client_read_plain (vs=3D0x55625f3c6000) 5 vnc_client_read (vs=3D0x55625f3c6000) 6 vnc_client_io (ioc=3D, condition=3DG_IO_IN, ... 7 g_main_dispatch (context=3D0x556251568a50) 8 g_main_context_dispatch (context=3Dcontext@entry=3D0x556251568a50) 9 glib_pollfds_poll () 10 os_host_main_loop_wait (timeout=3D) 11 main_loop_wait (nonblocking=3Dnonblocking@entry=3D0) 12 main_loop () at vl.c:1909 13 main (argc=3D, argv=3D, ... Having analyzed the coredump, I understood that the reason is that ioc_tag is reset on vnc_disconnect_start and ioc is cleaned in vnc_disconnect_finish. Between these two events due to some reasons the ioc_tag was set again and after vnc_disconnect_finish the handler is running with freed ioc, which led to the segmentation fault. The patch checks vs->disconnecting in places where we call qio_channel_add_watch and resets handler if disconnecting =3D=3D TRUE to prevent such an occurrence. Signed-off-by: Klim Kireev Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20180207094844.21402-1-klim.kireev@virtuozzo.com Signed-off-by: Gerd Hoffmann --- ui/vnc-jobs.c | 6 ++++-- ui/vnc.c | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ui/vnc-jobs.c b/ui/vnc-jobs.c index e326679dd0..868dddef4b 100644 --- a/ui/vnc-jobs.c +++ b/ui/vnc-jobs.c @@ -148,8 +148,10 @@ void vnc_jobs_consume_buffer(VncState *vs) if (vs->ioc_tag) { g_source_remove(vs->ioc_tag); } - vs->ioc_tag =3D qio_channel_add_watch( - vs->ioc, G_IO_IN | G_IO_OUT, vnc_client_io, vs, NULL); + if (vs->disconnecting =3D=3D FALSE) { + vs->ioc_tag =3D qio_channel_add_watch( + vs->ioc, G_IO_IN | G_IO_OUT, vnc_client_io, vs, NULL); + } } buffer_move(&vs->output, &vs->jobs_buffer); =20 diff --git a/ui/vnc.c b/ui/vnc.c index b97769aa9e..e371710f4f 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1536,12 +1536,19 @@ gboolean vnc_client_io(QIOChannel *ioc G_GNUC_UNUSE= D, VncState *vs =3D opaque; if (condition & G_IO_IN) { if (vnc_client_read(vs) < 0) { - return TRUE; + goto end; } } if (condition & G_IO_OUT) { vnc_client_write(vs); } +end: + if (vs->disconnecting) { + if (vs->ioc_tag !=3D 0) { + g_source_remove(vs->ioc_tag); + } + vs->ioc_tag =3D 0; + } return TRUE; } =20 @@ -1630,6 +1637,12 @@ void vnc_flush(VncState *vs) if (vs->ioc !=3D NULL && vs->output.offset) { vnc_client_write_locked(vs); } + if (vs->disconnecting) { + if (vs->ioc_tag !=3D 0) { + g_source_remove(vs->ioc_tag); + } + vs->ioc_tag =3D 0; + } vnc_unlock_output(vs); } =20 --=20 2.9.3 From nobody Fri Oct 24 09:58:53 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518782193341458.8648605869281; Fri, 16 Feb 2018 03:56:33 -0800 (PST) Received: from localhost ([::1]:40509 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emecw-0002y8-9c for importer@patchew.org; Fri, 16 Feb 2018 06:56:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emeao-0001dP-Pg for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emeal-0003ff-JR for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:18 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33016 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emeal-0003eO-DL for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:15 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A84CC407519B; Fri, 16 Feb 2018 11:54:13 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-147.ams2.redhat.com [10.36.116.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DB85D1BA7; Fri, 16 Feb 2018 11:54:11 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C28304F29E; Fri, 16 Feb 2018 12:54:10 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 12:54:05 +0100 Message-Id: <20180216115410.27287-5-kraxel@redhat.com> In-Reply-To: <20180216115410.27287-1-kraxel@redhat.com> References: <20180216115410.27287-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 16 Feb 2018 11:54:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 16 Feb 2018 11:54:13 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 4/9] sdl: restore optimized redraw X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann , Anatoly Trosinenko Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Anatoly Trosinenko The documentation on SDL_RenderPresent function states that "the backbuffer should be considered invalidated after each present", so copy the entire texture on each redraw. On the other hand, SDL_UpdateTexture function is described as "fairly slow function", so restrict it to just the changed pixels. Also added SDL_RenderClear call, as suggested in the documentation page on SDL_RenderPresent. Signed-off-by: Anatoly Trosinenko Message-id: 20180205133228.25082-1-anatoly.trosinenko@gmail.com Signed-off-by: Gerd Hoffmann --- ui/sdl2-2d.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/ui/sdl2-2d.c b/ui/sdl2-2d.c index 8ab68d67b9..1f34817bae 100644 --- a/ui/sdl2-2d.c +++ b/ui/sdl2-2d.c @@ -36,6 +36,8 @@ void sdl2_2d_update(DisplayChangeListener *dcl, struct sdl2_console *scon =3D container_of(dcl, struct sdl2_console, d= cl); DisplaySurface *surf =3D qemu_console_surface(dcl->con); SDL_Rect rect; + size_t surface_data_offset =3D surface_bytes_per_pixel(surf) * x + + surface_stride(surf) * y; =20 assert(!scon->opengl); =20 @@ -46,27 +48,16 @@ void sdl2_2d_update(DisplayChangeListener *dcl, return; } =20 - /* - * SDL2 seems to do some double-buffering, and trying to only - * update the changed areas results in only one of the two buffers - * being updated. Which flickers alot. So lets not try to be - * clever do a full update every time ... - */ -#if 0 rect.x =3D x; rect.y =3D y; rect.w =3D w; rect.h =3D h; -#else - rect.x =3D 0; - rect.y =3D 0; - rect.w =3D surface_width(surf); - rect.h =3D surface_height(surf); -#endif =20 - SDL_UpdateTexture(scon->texture, NULL, surface_data(surf), + SDL_UpdateTexture(scon->texture, &rect, + surface_data(surf) + surface_data_offset, surface_stride(surf)); - SDL_RenderCopy(scon->real_renderer, scon->texture, &rect, &rect); + SDL_RenderClear(scon->real_renderer); + SDL_RenderCopy(scon->real_renderer, scon->texture, NULL, NULL); SDL_RenderPresent(scon->real_renderer); } =20 --=20 2.9.3 From nobody Fri Oct 24 09:58:53 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518782538915784.0188714191607; Fri, 16 Feb 2018 04:02:18 -0800 (PST) Received: from localhost ([::1]:40759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emeiT-0007lO-2z for importer@patchew.org; Fri, 16 Feb 2018 07:02:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emeao-0001dJ-Mt for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emeal-0003fB-Gh for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:18 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33710 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emeal-0003e9-BE for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:15 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 56C62402291E for ; Fri, 16 Feb 2018 11:54:12 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-147.ams2.redhat.com [10.36.116.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26B3D2026DFD; Fri, 16 Feb 2018 11:54:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CB0664F29F; Fri, 16 Feb 2018 12:54:10 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 12:54:06 +0100 Message-Id: <20180216115410.27287-6-kraxel@redhat.com> In-Reply-To: <20180216115410.27287-1-kraxel@redhat.com> References: <20180216115410.27287-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 16 Feb 2018 11:54:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 16 Feb 2018 11:54:12 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 5/9] sdl2: fix mouse grab X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When qemu mouse mode changes from relative to absolute we must turn off sdl relative mouse mode too. Fixes: https://bugs.launchpad.net/qemu/+bug/1703795 Signed-off-by: Gerd Hoffmann Message-Id: <20180202120803.11501-1-kraxel@redhat.com> --- ui/sdl2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/sdl2.c b/ui/sdl2.c index 812c315891..858e04d7c0 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -249,6 +249,7 @@ static void sdl_mouse_mode_change(Notifier *notify, voi= d *data) if (qemu_input_is_absolute()) { if (!absolute_enabled) { absolute_enabled =3D 1; + SDL_SetRelativeMouseMode(SDL_FALSE); absolute_mouse_grab(&sdl2_console[0]); } } else if (absolute_enabled) { --=20 2.9.3 From nobody Fri Oct 24 09:58:53 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518782199302299.35773893970224; Fri, 16 Feb 2018 03:56:39 -0800 (PST) Received: from localhost ([::1]:40510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emecv-0002yS-67 for importer@patchew.org; Fri, 16 Feb 2018 06:56:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emeao-0001dQ-Qr for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emeal-0003fK-IP for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:18 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33712 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emeal-0003eN-Co for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:15 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 621244022931 for ; Fri, 16 Feb 2018 11:54:12 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-147.ams2.redhat.com [10.36.116.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 289E6213AEE2; Fri, 16 Feb 2018 11:54:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D32914F965; Fri, 16 Feb 2018 12:54:10 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 12:54:07 +0100 Message-Id: <20180216115410.27287-7-kraxel@redhat.com> In-Reply-To: <20180216115410.27287-1-kraxel@redhat.com> References: <20180216115410.27287-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 16 Feb 2018 11:54:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 16 Feb 2018 11:54:12 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 6/9] ui: avoid risk of 32-bit int overflow in VNC buffer check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Daniel P. Berrang=C3=A9 For very large framebuffers, it is theoretically possible for the result of 'vs->throttle_output_offset * VNC_THROTTLE_OUTPUT_LIMIT_SCALE' to exceed the size of a 32-bit int. For this to happen in practice, the video RAM would have to be set to a large enough value, which is not likely today. None the less we can be paranoid against future growth by using division instead of multiplication when checking the limits. Reported-by: Laszlo Ersek Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20180205114938.15784-2-berrange@redhat.com Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index e371710f4f..746293ddfa 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1579,8 +1579,8 @@ void vnc_write(VncState *vs, const void *data, size_t= len) * handshake, or from the job thread's VncState clone */ if (vs->throttle_output_offset !=3D 0 && - vs->output.offset > (vs->throttle_output_offset * - VNC_THROTTLE_OUTPUT_LIMIT_SCALE)) { + (vs->output.offset / VNC_THROTTLE_OUTPUT_LIMIT_SCALE) > + vs->throttle_output_offset) { trace_vnc_client_output_limit(vs, vs->ioc, vs->output.offset, vs->throttle_output_offset); vnc_disconnect_start(vs); --=20 2.9.3 From nobody Fri Oct 24 09:58:53 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518782199301327.5723204182532; Fri, 16 Feb 2018 03:56:39 -0800 (PST) Received: from localhost ([::1]:40511 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emecw-0002z7-De for importer@patchew.org; Fri, 16 Feb 2018 06:56:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emeao-0001dH-MY for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emeal-0003fj-Kw for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:18 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43119 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emeal-0003e8-Dt for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:15 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6C4C6404085A for ; Fri, 16 Feb 2018 11:54:12 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-147.ams2.redhat.com [10.36.116.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A0FD213AEE4; Fri, 16 Feb 2018 11:54:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DB4344F970; Fri, 16 Feb 2018 12:54:10 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 12:54:08 +0100 Message-Id: <20180216115410.27287-8-kraxel@redhat.com> In-Reply-To: <20180216115410.27287-1-kraxel@redhat.com> References: <20180216115410.27287-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 16 Feb 2018 11:54:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 16 Feb 2018 11:54:12 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 7/9] ui: avoid 'local_err' variable shadowing in VNC SASL auth X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Daniel P. Berrang=C3=A9 The start_auth_sasl() method declares a 'Error *local_err' variable in an inner if () {...} scope, which shadows a variable of the same name declared at the start of the method. This is confusing for reviewers and may trigger compiler warnings. Reported-by: Laszlo Ersek Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20180205114938.15784-3-berrange@redhat.com Signed-off-by: Gerd Hoffmann --- ui/vnc-auth-sasl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c index fbccca8c8a..8ebd0d3d00 100644 --- a/ui/vnc-auth-sasl.c +++ b/ui/vnc-auth-sasl.c @@ -556,7 +556,6 @@ void start_auth_sasl(VncState *vs) /* Inform SASL that we've got an external SSF layer from TLS/x509 */ if (vs->auth =3D=3D VNC_AUTH_VENCRYPT && vs->subauth =3D=3D VNC_AUTH_VENCRYPT_X509SASL) { - Error *local_err =3D NULL; int keysize; sasl_ssf_t ssf; =20 @@ -565,7 +564,6 @@ void start_auth_sasl(VncState *vs) if (keysize < 0) { trace_vnc_auth_fail(vs, vs->auth, "cannot TLS get cipher size", error_get_pretty(local_err)); - error_free(local_err); sasl_dispose(&vs->sasl.conn); vs->sasl.conn =3D NULL; goto authabort; --=20 2.9.3 From nobody Fri Oct 24 09:58:53 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518782366702480.3030121456226; Fri, 16 Feb 2018 03:59:26 -0800 (PST) Received: from localhost ([::1]:40628 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emefg-0005Te-SH for importer@patchew.org; Fri, 16 Feb 2018 06:59:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36356) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emeao-0001dM-OE for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emeal-0003fx-Lv for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:18 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38344 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emeal-0003eT-Dc for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:15 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7CEED8185324 for ; Fri, 16 Feb 2018 11:54:12 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-147.ams2.redhat.com [10.36.116.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BD912026E04; Fri, 16 Feb 2018 11:54:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E39344F98D; Fri, 16 Feb 2018 12:54:10 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 12:54:09 +0100 Message-Id: <20180216115410.27287-9-kraxel@redhat.com> In-Reply-To: <20180216115410.27287-1-kraxel@redhat.com> References: <20180216115410.27287-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 16 Feb 2018 11:54:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 16 Feb 2018 11:54:12 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 8/9] ui: check VNC audio frequency limit at time of reading from client X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Daniel P. Berrang=C3=A9 The 'vs->as.freq' value is a signed integer, which is read from an unsigned 32-bit int field on the wire. There is thus a risk of overflow on 32-bit platforms. Move the frequency limit checking to be done at time of read before casting to a signed integer. Reported-by: Laszlo Ersek Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20180205114938.15784-4-berrange@redhat.com Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 746293ddfa..a77b568b57 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -982,14 +982,7 @@ static void vnc_update_throttle_offset(VncState *vs) vs->client_width * vs->client_height * vs->client_pf.bytes_per_pix= el; =20 if (vs->audio_cap) { - int freq =3D vs->as.freq; - /* We don't limit freq when reading settings from client, so - * it could be upto MAX_INT in size. 48khz is a sensible - * upper bound for trustworthy clients */ int bps; - if (freq > 48000) { - freq =3D 48000; - } switch (vs->as.fmt) { default: case AUD_FMT_U8: @@ -1005,7 +998,7 @@ static void vnc_update_throttle_offset(VncState *vs) bps =3D 4; break; } - offset +=3D freq * bps * vs->as.nchannels; + offset +=3D vs->as.freq * bps * vs->as.nchannels; } =20 /* Put a floor of 1MB on offset, so that if we have a large pending @@ -2292,6 +2285,7 @@ static int protocol_client_msg(VncState *vs, uint8_t = *data, size_t len) { int i; uint16_t limit; + uint32_t freq; VncDisplay *vd =3D vs->vd; =20 if (data[0] > 3) { @@ -2411,7 +2405,17 @@ static int protocol_client_msg(VncState *vs, uint8_t= *data, size_t len) vnc_client_error(vs); break; } - vs->as.freq =3D read_u32(data, 6); + freq =3D read_u32(data, 6); + /* No official limit for protocol, but 48khz is a sensible + * upper bound for trustworthy clients, and this limit + * protects calculations involving 'vs->as.freq' later. + */ + if (freq > 48000) { + VNC_DEBUG("Invalid audio frequency %u > 48000", freq); + vnc_client_error(vs); + break; + } + vs->as.freq =3D freq; break; default: VNC_DEBUG("Invalid audio message %d\n", read_u8(data, 4)); --=20 2.9.3 From nobody Fri Oct 24 09:58:53 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151878236269045.56185755876504; Fri, 16 Feb 2018 03:59:22 -0800 (PST) Received: from localhost ([::1]:40625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emeff-0005SU-Nv for importer@patchew.org; Fri, 16 Feb 2018 06:59:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emeao-0001dN-OF for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emeal-0003fr-Mf for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:18 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43666 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emeal-0003eD-Dh for qemu-devel@nongnu.org; Fri, 16 Feb 2018 06:54:15 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4EDC08424E for ; Fri, 16 Feb 2018 11:54:14 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-147.ams2.redhat.com [10.36.116.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DBFC100F9C2; Fri, 16 Feb 2018 11:54:12 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EBC2C4F98E; Fri, 16 Feb 2018 12:54:10 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 12:54:10 +0100 Message-Id: <20180216115410.27287-10-kraxel@redhat.com> In-Reply-To: <20180216115410.27287-1-kraxel@redhat.com> References: <20180216115410.27287-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 16 Feb 2018 11:54:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 16 Feb 2018 11:54:14 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 9/9] ui: extend VNC trottling tracing to SASL codepaths X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Daniel P. Berrang=C3=A9 In previous commit: commit 6aa22a29187e1908f5db738d27c64a9efc8d0bfa Author: Daniel P. Berrange Date: Mon Dec 18 19:12:27 2017 +0000 ui: add trace events related to VNC client throttling trace points related to unthrottling client I/O were missed from the SASL codepaths. Reported-by: Laszlo Ersek Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Laszlo Ersek Message-id: 20180205114938.15784-5-berrange@redhat.com Signed-off-by: Gerd Hoffmann --- ui/vnc-auth-sasl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c index 8ebd0d3d00..3751a777a4 100644 --- a/ui/vnc-auth-sasl.c +++ b/ui/vnc-auth-sasl.c @@ -79,12 +79,23 @@ size_t vnc_client_write_sasl(VncState *vs) =20 vs->sasl.encodedOffset +=3D ret; if (vs->sasl.encodedOffset =3D=3D vs->sasl.encodedLength) { + bool throttled =3D vs->force_update_offset !=3D 0; + size_t offset; if (vs->sasl.encodedRawLength >=3D vs->force_update_offset) { vs->force_update_offset =3D 0; } else { vs->force_update_offset -=3D vs->sasl.encodedRawLength; } + if (throttled && vs->force_update_offset =3D=3D 0) { + trace_vnc_client_unthrottle_forced(vs, vs->ioc); + } + offset =3D vs->output.offset; buffer_advance(&vs->output, vs->sasl.encodedRawLength); + if (offset >=3D vs->throttle_output_offset && + vs->output.offset < vs->throttle_output_offset) { + trace_vnc_client_unthrottle_incremental(vs, vs->ioc, + vs->output.offset); + } vs->sasl.encoded =3D NULL; vs->sasl.encodedOffset =3D vs->sasl.encodedLength =3D 0; } --=20 2.9.3