From nobody Sat Apr 27 06:18:03 2024 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491480436763568.1960050684866; Thu, 6 Apr 2017 05:07:16 -0700 (PDT) Received: from localhost ([::1]:45417 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cw6C3-00017e-HP for importer@patchew.org; Thu, 06 Apr 2017 08:07:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cw6AL-0008ES-6w for qemu-devel@nongnu.org; Thu, 06 Apr 2017 08:05:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cw6AK-0002M2-Gt for qemu-devel@nongnu.org; Thu, 06 Apr 2017 08:05:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4715) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cw6AK-0002LU-BR for qemu-devel@nongnu.org; Thu, 06 Apr 2017 08:05:28 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 555FC2EF165 for ; Thu, 6 Apr 2017 12:05:27 +0000 (UTC) Received: from localhost (unknown [10.41.0.137]) by smtp.corp.redhat.com (Postfix) with ESMTP id 785EF1719F; Thu, 6 Apr 2017 12:05:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 555FC2EF165 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=marcandre.lureau@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 555FC2EF165 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 6 Apr 2017 14:05:11 +0200 Message-Id: <20170406120513.638-2-marcandre.lureau@redhat.com> In-Reply-To: <20170406120513.638-1-marcandre.lureau@redhat.com> References: <20170406120513.638-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 06 Apr 2017 12:05:27 +0000 (UTC) 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: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/3] console: add same surface replace pre-condition 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com, dgilbert@redhat.com 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" Catch an invalid state early, before a potential use-after-free. This is mainly useful for documentation purposes. Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/console.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/console.c b/ui/console.c index 419b098c11..0cbe5033dd 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1538,6 +1538,8 @@ void dpy_gfx_replace_surface(QemuConsole *con, DisplaySurface *old_surface =3D con->surface; DisplayChangeListener *dcl; =20 + assert(old_surface !=3D surface); + con->surface =3D surface; QLIST_FOREACH(dcl, &s->listeners, next) { if (con !=3D (dcl->con ? dcl->con : active_console)) { --=20 2.12.0.191.gc5d8de91d From nobody Sat Apr 27 06:18:03 2024 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491480486733522.1995667112685; Thu, 6 Apr 2017 05:08:06 -0700 (PDT) Received: from localhost ([::1]:45420 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cw6Cr-0001fv-Gw for importer@patchew.org; Thu, 06 Apr 2017 08:08:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cw6AT-0008KE-KL for qemu-devel@nongnu.org; Thu, 06 Apr 2017 08:05:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cw6AP-0002OM-Lo for qemu-devel@nongnu.org; Thu, 06 Apr 2017 08:05:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58158) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cw6AP-0002Nl-FL for qemu-devel@nongnu.org; Thu, 06 Apr 2017 08:05:33 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8947EA7551 for ; Thu, 6 Apr 2017 12:05:32 +0000 (UTC) Received: from localhost (unknown [10.41.0.137]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49CB28B145; Thu, 6 Apr 2017 12:05:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8947EA7551 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=marcandre.lureau@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8947EA7551 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 6 Apr 2017 14:05:12 +0200 Message-Id: <20170406120513.638-3-marcandre.lureau@redhat.com> In-Reply-To: <20170406120513.638-1-marcandre.lureau@redhat.com> References: <20170406120513.638-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 06 Apr 2017 12:05:32 +0000 (UTC) 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: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/3] console: add same displaychangelistener registration pre-condition 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com, dgilbert@redhat.com 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" Catch an invalid state. Mainly useful for documentation purposes. Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/console.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/console.c b/ui/console.c index 0cbe5033dd..189eecfd29 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1410,6 +1410,8 @@ void register_displaychangelistener(DisplayChangeList= ener *dcl) static DisplaySurface *dummy; QemuConsole *con; =20 + assert(!dcl->ds); + if (dcl->ops->dpy_gl_ctx_create) { /* display has opengl support */ assert(dcl->con); --=20 2.12.0.191.gc5d8de91d From nobody Sat Apr 27 06:18:03 2024 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14914805237371002.7823300711295; Thu, 6 Apr 2017 05:08:43 -0700 (PDT) Received: from localhost ([::1]:45423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cw6DS-00027i-MX for importer@patchew.org; Thu, 06 Apr 2017 08:08:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cw6Ab-0008RD-Gf for qemu-devel@nongnu.org; Thu, 06 Apr 2017 08:05:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cw6AV-0002R0-K7 for qemu-devel@nongnu.org; Thu, 06 Apr 2017 08:05:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35092) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cw6AV-0002QW-CI for qemu-devel@nongnu.org; Thu, 06 Apr 2017 08:05:39 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 40F73BB0D for ; Thu, 6 Apr 2017 12:05:38 +0000 (UTC) Received: from localhost (unknown [10.41.0.137]) by smtp.corp.redhat.com (Postfix) with ESMTP id 783FBA8633; Thu, 6 Apr 2017 12:05:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 40F73BB0D Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=marcandre.lureau@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 40F73BB0D From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 6 Apr 2017 14:05:13 +0200 Message-Id: <20170406120513.638-4-marcandre.lureau@redhat.com> In-Reply-To: <20170406120513.638-1-marcandre.lureau@redhat.com> References: <20170406120513.638-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 06 Apr 2017 12:05:38 +0000 (UTC) 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: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/3] qxl: switch display on entering VGA 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com, dgilbert@redhat.com 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" Since commit cd958edb1fae85d, same size console resize is skipped. This change broke QXL incoming migration in VGA mode, qemu_spice_display_switch() is no longer called during qxl_post_load(), because default message surface is of the same size, and during displaychangelistener registration, PCIQXLDevice.mode is QXL_MODE_UNDEFINED. This triggers a later crash on refresh: =3D=3D2634=3D=3D Invalid read of size 4 =3D=3D3516=3D=3D at 0x65F3050: pixman_image_get_data (in /usr/lib64/libpixm= an-1.so.0.34.0) =3D=3D3516=3D=3D by 0x6F0CEB: qemu_spice_create_update (spice-display.c:215) =3D=3D3516=3D=3D by 0x6F1CC7: qemu_spice_display_refresh (spice-display.c:5= 02) =3D=3D3516=3D=3D by 0x58CF77: display_refresh (qxl.c:1948) =3D=3D3516=3D=3D by 0x6E8084: do_safe_dpy_refresh (console.c:1591) =3D=3D3516=3D=3D by 0x6E80D5: dpy_refresh (console.c:1604) =3D=3D3516=3D=3D by 0x6E4508: gui_update (console.c:201) =3D=3D3516=3D=3D by 0x81898E: timerlist_run_timers (qemu-timer.c:536) =3D=3D3516=3D=3D by 0x8189D6: qemu_clock_run_timers (qemu-timer.c:547) =3D=3D3516=3D=3D by 0x818D98: qemu_clock_run_all_timers (qemu-timer.c:662) =3D=3D3516=3D=3D by 0x81952A: main_loop_wait (main-loop.c:514) =3D=3D3516=3D=3D by 0x4ADD29: main_loop (vl.c:1898) One way to solve this is to explicitely call qemu_spice_display_switch() on entering VGA mode, which is called during qxl_post_load(). Fixes: "null pointer access on migration resume of systemrescuecd boot menu with q= xl-vga" https://bugs.launchpad.net/qemu/+bug/1679126 https://bugzilla.redhat.com/show_bug.cgi?id=3D1438566 Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/display/qxl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/display/qxl.c b/hw/display/qxl.c index 0d02f0efe6..c31b293bb7 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -1146,6 +1146,7 @@ static void qxl_enter_vga_mode(PCIQXLDevice *d) update_displaychangelistener(&d->ssd.dcl, GUI_REFRESH_INTERVAL_DEFAULT= ); qemu_spice_create_host_primary(&d->ssd); d->mode =3D QXL_MODE_VGA; + qemu_spice_display_switch(&d->ssd, d->ssd.ds); vga_dirty_log_start(&d->vga); graphic_hw_update(d->vga.con); } --=20 2.12.0.191.gc5d8de91d