From nobody Mon May 20 00:09:15 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.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 1540460138190127.98492570709777; Thu, 25 Oct 2018 02:35:38 -0700 (PDT) Received: from localhost ([::1]:53421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFc3E-0002JO-Tb for importer@patchew.org; Thu, 25 Oct 2018 05:35:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFbzT-0007Zu-0a for qemu-devel@nongnu.org; Thu, 25 Oct 2018 05:31:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFbzO-0008Ui-1C for qemu-devel@nongnu.org; Thu, 25 Oct 2018 05:31:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56918) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFbzM-0008Ik-CB for qemu-devel@nongnu.org; Thu, 25 Oct 2018 05:31:37 -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 9015230C9EE8 for ; Thu, 25 Oct 2018 09:31:30 +0000 (UTC) Received: from lupin.home.kraxel.org (ovpn-117-207.ams2.redhat.com [10.36.117.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 722A360F80; Thu, 25 Oct 2018 09:31:24 +0000 (UTC) Received: by lupin.home.kraxel.org (Postfix, from userid 1000) id 572FB628B92B; Thu, 25 Oct 2018 10:52:56 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:52:54 +0200 Message-Id: <20181025085256.20522-2-kraxel@redhat.com> In-Reply-To: <20181025085256.20522-1-kraxel@redhat.com> References: <20181025085256.20522-1-kraxel@redhat.com> 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.42]); Thu, 25 Oct 2018 09:31:30 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/3] qdev: add deprecation_reason to DeviceClass 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: libvir-list@redhat.com, Gerd Hoffmann , Prasad J Pandit Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Simliar to deprecated machine types. Print a warning when creating a deprecated device. Add deprecation notice to -device help. TODO: add to intospection. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/qdev.c | 9 ++++++++- include/hw/qdev-core.h | 1 + qdev-monitor.c | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 046d8f1..3b27a74 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -133,11 +133,18 @@ DeviceState *qdev_create(BusState *bus, const char *n= ame) =20 DeviceState *qdev_try_create(BusState *bus, const char *type) { + DeviceClass *dc; DeviceState *dev; =20 - if (object_class_by_name(type) =3D=3D NULL) { + dc =3D DEVICE_CLASS(object_class_by_name(type)); + if (dc =3D=3D NULL) { return NULL; } + if (dc->deprecation_reason) { + warn_report("device %s is deprecated (%s)", + type, dc->deprecation_reason); + } + dev =3D DEVICE(object_new(type)); if (!dev) { return NULL; diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index a24d0dd..a352eaa 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -105,6 +105,7 @@ typedef struct DeviceClass { */ bool user_creatable; bool hotpluggable; + const char *deprecation_reason; =20 /* callbacks */ DeviceReset reset; diff --git a/qdev-monitor.c b/qdev-monitor.c index 802c18a..bbba2bc 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -128,6 +128,9 @@ static void qdev_print_devinfo(DeviceClass *dc) if (!dc->user_creatable) { out_printf(", no-user"); } + if (!dc->deprecation_reason) { + out_printf(", deprecated"); + } out_printf("\n"); } =20 @@ -579,6 +582,10 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **e= rrp) if (!dc) { return NULL; } + if (dc->deprecation_reason) { + warn_report("device %s is deprecated (%s)", + driver, dc->deprecation_reason); + } =20 /* find bus */ path =3D qemu_opt_get(opts, "bus"); --=20 2.9.3 From nobody Mon May 20 00:09:15 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.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 1540460143264712.6432812076625; Thu, 25 Oct 2018 02:35:43 -0700 (PDT) Received: from localhost ([::1]:53422 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFc3K-0002LC-8t for importer@patchew.org; Thu, 25 Oct 2018 05:35:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFbzT-0007Zv-0b for qemu-devel@nongnu.org; Thu, 25 Oct 2018 05:31:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFbzO-0008Uf-1O for qemu-devel@nongnu.org; Thu, 25 Oct 2018 05:31:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49876) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFbzM-0008Ib-C9 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 05:31:37 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6184E30F5593 for ; Thu, 25 Oct 2018 09:31:30 +0000 (UTC) Received: from lupin.home.kraxel.org (ovpn-117-207.ams2.redhat.com [10.36.117.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 718FF102BCEB; Thu, 25 Oct 2018 09:31:24 +0000 (UTC) Received: by lupin.home.kraxel.org (Postfix, from userid 1000) id 5888F628B937; Thu, 25 Oct 2018 10:52:56 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:52:55 +0200 Message-Id: <20181025085256.20522-3-kraxel@redhat.com> In-Reply-To: <20181025085256.20522-1-kraxel@redhat.com> References: <20181025085256.20522-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 25 Oct 2018 09:31:30 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/3] adlib: mark as insecure and deprecated. 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: libvir-list@redhat.com, Gerd Hoffmann , Prasad J Pandit Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We have a lovely, guest-triggerable buffer overflow in opl2 emulation. Reproducer: outw(0xff60, 0x220); outw(0x1020, 0x220); outw(0xffb0, 0x220); Result: Will overflow FM_OPL->AR_TABLE[] (see hw/audio/fmopl.[ch]) The specs google finds (http://www.symphoniae.com/Yamaha/YSC/YM3812.pdf) are rather sparse, possibly incomplete (looks like scanned fax with a scrambled page at the end) and not really helpful in identifying which of the register writes sets some illegal value. So, go tag the device as deprecated with a warning messge, to notify users and schedule it for removal according to our deprecation policy. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- hw/audio/adlib.c | 1 + qemu-deprecated.texi | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index 97b876c..fb4a29c 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -311,6 +311,7 @@ static void adlib_class_initfn (ObjectClass *klass, voi= d *data) set_bit(DEVICE_CATEGORY_SOUND, dc->categories); dc->desc =3D ADLIB_DESC; dc->props =3D adlib_properties; + dc->deprecation_reason =3D "insecure, buffer overflow in opl2 emulatio= n"; } =20 static const TypeInfo adlib_info =3D { diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 11b870c..7951a4f 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -116,6 +116,10 @@ The @option{[hub_id name]} parameter tuple of the 'hos= tfwd_add' and The ``ivshmem'' device type is replaced by either the ``ivshmem-plain'' or ``ivshmem-doorbell`` device types. =20 +@subsection adlib (since 3.1) + +Has known buffer overflow. + @section System emulator machines =20 @subsection pc-0.10 and pc-0.11 (since 3.0) --=20 2.9.3 From nobody Mon May 20 00:09:15 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.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 1540460008630942.2024441256821; Thu, 25 Oct 2018 02:33:28 -0700 (PDT) Received: from localhost ([::1]:53400 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFc10-0000qu-K4 for importer@patchew.org; Thu, 25 Oct 2018 05:33:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFbzT-0007Zx-0p for qemu-devel@nongnu.org; Thu, 25 Oct 2018 05:31:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFbzO-0008Ue-1O for qemu-devel@nongnu.org; Thu, 25 Oct 2018 05:31:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59680) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFbzM-0008Ia-CA for qemu-devel@nongnu.org; Thu, 25 Oct 2018 05:31:37 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5FBAB308429D for ; Thu, 25 Oct 2018 09:31:30 +0000 (UTC) Received: from lupin.home.kraxel.org (ovpn-117-207.ams2.redhat.com [10.36.117.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71A811057044; Thu, 25 Oct 2018 09:31:24 +0000 (UTC) Received: by lupin.home.kraxel.org (Postfix, from userid 1000) id 5CC70628B94B; Thu, 25 Oct 2018 10:52:56 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:52:56 +0200 Message-Id: <20181025085256.20522-4-kraxel@redhat.com> In-Reply-To: <20181025085256.20522-1-kraxel@redhat.com> References: <20181025085256.20522-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 25 Oct 2018 09:31:30 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/3] cirrus: mark as deprecated 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: libvir-list@redhat.com, Gerd Hoffmann , Prasad J Pandit Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" While being at it deprecate cirrus too. Reason (short version): use stdvga instead. Verbose version: https://www.kraxel.org/blog/2014/10/qemu-using-cirrus-considered-harmful Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Prasad J Pandit Reviewed-by: Thomas Huth --- hw/display/cirrus_vga.c | 2 ++ hw/display/cirrus_vga_isa.c | 2 ++ qemu-deprecated.texi | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c index d9b854d..2f16ba9 100644 --- a/hw/display/cirrus_vga.c +++ b/hw/display/cirrus_vga.c @@ -3024,6 +3024,8 @@ static void cirrus_vga_class_init(ObjectClass *klass,= void *data) dc->vmsd =3D &vmstate_pci_cirrus_vga; dc->props =3D pci_vga_cirrus_properties; dc->hotpluggable =3D false; + dc->deprecation_reason =3D + "https://www.kraxel.org/blog/2014/10/qemu-using-cirrus-considered-= harmful"; } =20 static const TypeInfo cirrus_vga_info =3D { diff --git a/hw/display/cirrus_vga_isa.c b/hw/display/cirrus_vga_isa.c index fa10b74..c2d853c 100644 --- a/hw/display/cirrus_vga_isa.c +++ b/hw/display/cirrus_vga_isa.c @@ -81,6 +81,8 @@ static void isa_cirrus_vga_class_init(ObjectClass *klass,= void *data) dc->realize =3D isa_cirrus_vga_realizefn; dc->props =3D isa_cirrus_vga_properties; set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); + dc->deprecation_reason =3D + "https://www.kraxel.org/blog/2014/10/qemu-using-cirrus-considered-= harmful"; } =20 static const TypeInfo isa_cirrus_vga_info =3D { diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 7951a4f..1b1d434 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -120,6 +120,10 @@ or ``ivshmem-doorbell`` device types. =20 Has known buffer overflow. =20 +@subsection cirrus (since 3.1) + +Use stdvga instead (-vga std or -device VGA). + @section System emulator machines =20 @subsection pc-0.10 and pc-0.11 (since 3.0) --=20 2.9.3