From nobody Wed Nov 12 08:34:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569927223; cv=none; d=zoho.com; s=zohoarc; b=PHZ6E3+dF1EiEX5h8XcEHsBAvZZBaNDbxUoN7tQT5Rr3p7/z/1/10oLhV04tHWyQ5AGFAfhez+N5BNMaEJP9G+5pPKQuSZUsJXQ1Q6Gv/snVj1S0EE/hNRWmIcZW6mmIJPHOnGDseQ4dB3P2tb+N21JxW67wSfOlc5sIo//jNlA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569927223; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=G5CFiuiqaRCkliY4q7VTLTfdIQw/felFxkk0iIwuHn4=; b=jetp6KW9h56OED4Sl7uCebQtQpC759/XUk2k2I3clnzFcP47cgag+6AOG3BLXKmIetBR53hXz5wS+Wfuq86xPS7gH4+i65A1FowHXACI2jQGpn3V4RNrR1B8NXG8gcBnKgjPj1PdqZ+dPhrRFu7/mPFLebRkaVZ//vz/jR7zV08= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569927223269330.1028131882174; Tue, 1 Oct 2019 03:53:43 -0700 (PDT) Received: from localhost ([::1]:40324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFFmn-0005Lh-QP for importer@patchew.org; Tue, 01 Oct 2019 06:53:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51885) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFFkI-0003X3-HJ for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFFkG-0007M1-Mt for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41556) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFFkG-0007Ky-F0 for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:04 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 548E530842A8; Tue, 1 Oct 2019 10:51:03 +0000 (UTC) Received: from thuth.com (ovpn-116-70.ams2.redhat.com [10.36.116.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7872819D70; Tue, 1 Oct 2019 10:51:02 +0000 (UTC) From: Thomas Huth To: Peter Maydell Subject: [PULL 1/5] tests: fix usb-hcd-ehci-test compilation Date: Tue, 1 Oct 2019 12:50:53 +0200 Message-Id: <20191001105057.3949-2-thuth@redhat.com> In-Reply-To: <20191001105057.3949-1-thuth@redhat.com> References: <20191001105057.3949-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 01 Oct 2019 10:51:03 +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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Fixes commit e5758de4e836c3b2edc2befd904651fc6967d74f ("tests/libqtest: Make qtest_qmp_device_add/del independent from global_qtest") and commit dd210749727530cdef7c335040edbf81c3c5d041 ("tests/libqtest: Use libqtest-single.h in tests that require global_qtest"). Cc: Thomas Huth Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20190926111955.17276-2-marcandre.lureau@redhat.com> Reviewed-by: Laurent Vivier Signed-off-by: Thomas Huth --- tests/usb-hcd-ehci-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/usb-hcd-ehci-test.c b/tests/usb-hcd-ehci-test.c index 8bc3e44189..5251d539e9 100644 --- a/tests/usb-hcd-ehci-test.c +++ b/tests/usb-hcd-ehci-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "libqos/pci-pc.h" #include "hw/usb/uhci-regs.h" #include "hw/usb/ehci-regs.h" @@ -139,7 +139,7 @@ static void pci_ehci_port_3_hotplug(void) =20 static void pci_ehci_port_hotplug(void) { - usb_test_hotplug("ich9-ehci-1", "3", pci_ehci_port_3_hotplug); + usb_test_hotplug(global_qtest, "ich9-ehci-1", "3", pci_ehci_port_3_hot= plug); } =20 =20 --=20 2.18.1 From nobody Wed Nov 12 08:34:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569927312; cv=none; d=zoho.com; s=zohoarc; b=m3Oo4rQK1A+oPbFJOk8T9PH07w/dffWbooQqPAeUnOMk8IT2yH8GMNHoiKi/nfDXMyCrgf2//OcxCOlCsRP2zQmzKozxTjNyTBdmEmfeo7VR24iijePdRLMCTsuJOWehMVyb0l3mRl7bP2Z4awpKD0VIU3W0y8jpcnKEQM3L2sY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569927312; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=IlA1W5NFptQN/gRObC3hxpXX27+MAPrQUFWGT4x3nm8=; b=WyvswCl9eC6GyyuaavlIRad7sDso7WFs39sRCZg/YNLirgcmyOucmOUdM3t0gIcTaoOj2356dbObVwpksvYh3juNmXq4+EKDZHfpAxoYdTUJN7BFXd9MpTuqixN9hMHtLKJ7TfPxfQIV0AfEDqKUqSpIFkq58UIaRMsXpQq6aeA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569927312572313.57877412887296; Tue, 1 Oct 2019 03:55:12 -0700 (PDT) Received: from localhost ([::1]:40332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFFoF-00075D-D8 for importer@patchew.org; Tue, 01 Oct 2019 06:55:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51927) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFFkO-0003Xi-6y for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFFkM-0007Pl-6p for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33906) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFFkI-0007MA-DB for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:08 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8FCDB10DCC94; Tue, 1 Oct 2019 10:51:04 +0000 (UTC) Received: from thuth.com (ovpn-116-70.ams2.redhat.com [10.36.116.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF71446; Tue, 1 Oct 2019 10:51:03 +0000 (UTC) From: Thomas Huth To: Peter Maydell Subject: [PULL 2/5] tests: fix echi/ehci typo Date: Tue, 1 Oct 2019 12:50:54 +0200 Message-Id: <20191001105057.3949-3-thuth@redhat.com> In-Reply-To: <20191001105057.3949-1-thuth@redhat.com> References: <20191001105057.3949-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Tue, 01 Oct 2019 10:51:04 +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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau While at it, simplify using $(land). Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20190926111955.17276-3-marcandre.lureau@redhat.com> Reviewed-by: Laurent Vivier Reviewed-by: Thomas Huth Fixes: dad5ddcea3b661 ("check: Only test usb-ehci when it is compiled in") Signed-off-by: Thomas Huth --- tests/Makefile.include | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 0595914526..3543451ed3 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -182,9 +182,7 @@ check-qtest-i386-$(CONFIG_PVPANIC) +=3D tests/pvpanic-t= est$(EXESUF) check-qtest-i386-$(CONFIG_I82801B11) +=3D tests/i82801b11-test$(EXESUF) check-qtest-i386-$(CONFIG_IOH3420) +=3D tests/ioh3420-test$(EXESUF) check-qtest-i386-$(CONFIG_USB_UHCI) +=3D tests/usb-hcd-uhci-test$(EXESUF) -ifeq ($(CONFIG_USB_ECHI)$(CONFIG_USB_UHCI),yy) -check-qtest-i386-y +=3D tests/usb-hcd-ehci-test$(EXESUF) -endif +check-qtest-i386-$(call land,$(CONFIG_USB_EHCI),$(CONFIG_USB_UHCI)) +=3D t= ests/usb-hcd-ehci-test$(EXESUF) check-qtest-i386-$(CONFIG_USB_XHCI_NEC) +=3D tests/usb-hcd-xhci-test$(EXES= UF) check-qtest-i386-y +=3D tests/cpu-plug-test$(EXESUF) check-qtest-i386-y +=3D tests/q35-test$(EXESUF) --=20 2.18.1 From nobody Wed Nov 12 08:34:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569927452; cv=none; d=zoho.com; s=zohoarc; b=ifPXh1KPANQi1QlTiEoUEeukt19hhBQpsnXdJZJ0YJO85FjJVXFxafgoYmmTtM36vBfrRsckqnkSWjd5G6Pdp40Zv85uhVYZcTRaK/o1XCR0G2PwUxYJNKWci/f6OYeVsCwJMrDmgQ1/mbIvnkNfZehDthR7tgbxtrW8K6eRFDk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569927452; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=VI3y8paFsZL4pDRF25nfVYK+c8CRpVw3QuJD7BTGKPA=; b=B9tvLt0RjGNva5srgQff+6gDKZogWcZ9p0cA1+4Z5WogCktRQ0tEHTh2uaOk4gHmGPqQUbYnP4/9Z/oJ18grqAQVO84ttzIEzxBnM5f6DFE0cb7rK14/TUbqMkgH+9uljOuub/dwMTaJJ/WZ83dR1WNW9emYFLFdTvRCcRBZQ6g= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569927452332681.0375445235865; Tue, 1 Oct 2019 03:57:32 -0700 (PDT) Received: from localhost ([::1]:40358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFFqQ-0001pN-V8 for importer@patchew.org; Tue, 01 Oct 2019 06:57:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51953) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFFkT-0003bI-O0 for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFFkO-0007RL-4Y for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47548) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFFkK-0007NG-AT for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:10 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DBA7130A5A5A; Tue, 1 Oct 2019 10:51:05 +0000 (UTC) Received: from thuth.com (ovpn-116-70.ams2.redhat.com [10.36.116.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id E78CB46; Tue, 1 Oct 2019 10:51:04 +0000 (UTC) From: Thomas Huth To: Peter Maydell Subject: [PULL 3/5] hw/m68k/next-cube: Avoid static RTC variables and introduce control register Date: Tue, 1 Oct 2019 12:50:55 +0200 Message-Id: <20191001105057.3949-4-thuth@redhat.com> In-Reply-To: <20191001105057.3949-1-thuth@redhat.com> References: <20191001105057.3949-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 01 Oct 2019 10:51:05 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org 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" From: Thomas Huth Coverity currently complains that the "if (0x00 & (0x80 >> (phase - 8))" in next-cube.c can never be true. Right it is. The "0x00" is meant as value of the control register of the RTC, which is currently not implemented yet. Thus, let's add a register variable for this now. However, the RTC registers are currently defined as static variables in nextscr2_write(), which is quite ugly. Thus let's also move the RTC variables to the main machine state instead. In the long run, we should likely even refactor the whole RTC code into a separate device in a separate file, but that's something for calm winter nights later... as a first step, cleaning up the static variables and shutting up the warning from Coverity should be sufficient. Reviewed-by: Richard Henderson Message-Id: <20190921091738.26953-1-huth@tuxfamily.org> Signed-off-by: Thomas Huth --- hw/m68k/next-cube.c | 73 +++++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 9a4a7328f9..e5343348d0 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -60,6 +60,15 @@ typedef struct next_dma { uint32_t size; } next_dma; =20 +typedef struct NextRtc { + uint8_t ram[32]; + uint8_t command; + uint8_t value; + uint8_t status; + uint8_t control; + uint8_t retval; +} NextRtc; + typedef struct { MachineState parent; =20 @@ -77,7 +86,7 @@ typedef struct { uint32_t scr1; uint32_t scr2; =20 - uint8_t rtc_ram[32]; + NextRtc rtc; } NeXTState; =20 /* Thanks to NeXT forums for this */ @@ -105,11 +114,8 @@ static void nextscr2_write(NeXTState *s, uint32_t val,= int size) static int led; static int phase; static uint8_t old_scr2; - static uint8_t rtc_command; - static uint8_t rtc_value; - static uint8_t rtc_status =3D 0x90; - static uint8_t rtc_return; uint8_t scr2_2; + NextRtc *rtc =3D &s->rtc; =20 if (size =3D=3D 4) { scr2_2 =3D (val >> 8) & 0xFF; @@ -135,52 +141,52 @@ static void nextscr2_write(NeXTState *s, uint32_t val= , int size) if (((old_scr2 & SCR2_RTCLK) !=3D (scr2_2 & SCR2_RTCLK)) && ((scr2_2 & SCR2_RTCLK) =3D=3D 0)) { if (phase < 8) { - rtc_command =3D (rtc_command << 1) | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); + rtc->command =3D (rtc->command << 1) | + ((scr2_2 & SCR2_RTDATA) ? 1 : 0); } if (phase >=3D 8 && phase < 16) { - rtc_value =3D (rtc_value << 1) | ((scr2_2 & SCR2_RTDATA) ?= 1 : 0); + rtc->value =3D (rtc->value << 1) | + ((scr2_2 & SCR2_RTDATA) ? 1 : 0); =20 /* if we read RAM register, output RT_DATA bit */ - if (rtc_command <=3D 0x1F) { + if (rtc->command <=3D 0x1F) { scr2_2 =3D scr2_2 & (~SCR2_RTDATA); - if (s->rtc_ram[rtc_command] & (0x80 >> (phase - 8))) { + if (rtc->ram[rtc->command] & (0x80 >> (phase - 8))) { scr2_2 |=3D SCR2_RTDATA; } =20 - rtc_return =3D (rtc_return << 1) | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); + rtc->retval =3D (rtc->retval << 1) | + ((scr2_2 & SCR2_RTDATA) ? 1 : 0); } /* read the status 0x30 */ - if (rtc_command =3D=3D 0x30) { + if (rtc->command =3D=3D 0x30) { scr2_2 =3D scr2_2 & (~SCR2_RTDATA); /* for now status =3D 0x98 (new rtc + FTU) */ - if (rtc_status & (0x80 >> (phase - 8))) { + if (rtc->status & (0x80 >> (phase - 8))) { scr2_2 |=3D SCR2_RTDATA; } =20 - rtc_return =3D (rtc_return << 1) | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); + rtc->retval =3D (rtc->retval << 1) | + ((scr2_2 & SCR2_RTDATA) ? 1 : 0); } /* read the status 0x31 */ - if (rtc_command =3D=3D 0x31) { + if (rtc->command =3D=3D 0x31) { scr2_2 =3D scr2_2 & (~SCR2_RTDATA); - /* for now 0x00 */ - if (0x00 & (0x80 >> (phase - 8))) { + if (rtc->control & (0x80 >> (phase - 8))) { scr2_2 |=3D SCR2_RTDATA; } - rtc_return =3D (rtc_return << 1) | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); + rtc->retval =3D (rtc->retval << 1) | + ((scr2_2 & SCR2_RTDATA) ? 1 : 0); } =20 - if ((rtc_command >=3D 0x20) && (rtc_command <=3D 0x2F)) { + if ((rtc->command >=3D 0x20) && (rtc->command <=3D 0x2F)) { scr2_2 =3D scr2_2 & (~SCR2_RTDATA); /* for now 0x00 */ time_t time_h =3D time(NULL); struct tm *info =3D localtime(&time_h); int ret =3D 0; =20 - switch (rtc_command) { + switch (rtc->command) { case 0x20: ret =3D SCR2_TOBCD(info->tm_sec); break; @@ -205,22 +211,22 @@ static void nextscr2_write(NeXTState *s, uint32_t val= , int size) if (ret & (0x80 >> (phase - 8))) { scr2_2 |=3D SCR2_RTDATA; } - rtc_return =3D (rtc_return << 1) | - ((scr2_2 & SCR2_RTDATA) ? 1 : 0); + rtc->retval =3D (rtc->retval << 1) | + ((scr2_2 & SCR2_RTDATA) ? 1 : 0); } =20 } =20 phase++; if (phase =3D=3D 16) { - if (rtc_command >=3D 0x80 && rtc_command <=3D 0x9F) { - s->rtc_ram[rtc_command - 0x80] =3D rtc_value; + if (rtc->command >=3D 0x80 && rtc->command <=3D 0x9F) { + rtc->ram[rtc->command - 0x80] =3D rtc->value; } /* write to x30 register */ - if (rtc_command =3D=3D 0xB1) { + if (rtc->command =3D=3D 0xB1) { /* clear FTU */ - if (rtc_value & 0x04) { - rtc_status =3D rtc_status & (~0x18); + if (rtc->value & 0x04) { + rtc->status =3D rtc->status & (~0x18); s->int_status =3D s->int_status & (~0x04); } } @@ -229,8 +235,8 @@ static void nextscr2_write(NeXTState *s, uint32_t val, = int size) } else { /* else end or abort */ phase =3D -1; - rtc_command =3D 0; - rtc_value =3D 0; + rtc->command =3D 0; + rtc->value =3D 0; } s->scr2 =3D val & 0xFFFF00FF; s->scr2 |=3D scr2_2 << 8; @@ -881,9 +887,10 @@ static void next_cube_init(MachineState *machine) /* 0x0000XX00 << vital bits */ ns->scr1 =3D 0x00011102; ns->scr2 =3D 0x00ff0c80; + ns->rtc.status =3D 0x90; =20 /* Load RTC RAM - TODO: provide possibility to load contents from file= */ - memcpy(ns->rtc_ram, rtc_ram2, 32); + memcpy(ns->rtc.ram, rtc_ram2, 32); =20 /* 64MB RAM starting at 0x04000000 */ memory_region_allocate_system_memory(ram, NULL, "next.ram", ram_size); --=20 2.18.1 From nobody Wed Nov 12 08:34:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569927298; cv=none; d=zoho.com; s=zohoarc; b=FSeD3/iCEXeJJL0YLDPgS/Zv7BUSPd3IKGf/Ad85l95ksnYwzaB4/Fk6iilKkHU4NKPY3EQ7Ax6XJ3T9FWHJCmHd0sgHZ08xUtE5CNp6TtjawX7z+iaEZsPWkhAC37yPGKzkdBroVy4PkQl+sp9cQzjTWvRd5e4OsbjtfL6GNMc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569927298; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=rS9yq9Y0F55roECVG4z3VrBDdGm+WpmB74fnBmqnqsQ=; b=I7hi6fBUfao4+mw6gPVTlLdpzyv4Eo/2shWCBvfowwWoegb9gZLH1PUMilrCnQFQuvHm7vq9c1od304gvwyylMJmLTN/C3Kjps7wLPVjUY4B57PlnF701of17ksazYyZsx53JGUxYNecl+dVP6EIHGA3/EQLtOfN+aD30Hs+KeE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15699272986230.8442712951090243; Tue, 1 Oct 2019 03:54:58 -0700 (PDT) Received: from localhost ([::1]:40328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFFny-0006fm-HQ for importer@patchew.org; Tue, 01 Oct 2019 06:54:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51951) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFFkT-0003bG-NP for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFFkO-0007RS-5b for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47096) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFFkM-0007OI-5w for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:11 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 20E3E10CC201; Tue, 1 Oct 2019 10:51:07 +0000 (UTC) Received: from thuth.com (ovpn-116-70.ams2.redhat.com [10.36.116.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C56D26199; Tue, 1 Oct 2019 10:51:06 +0000 (UTC) From: Thomas Huth To: Peter Maydell Subject: [PULL 4/5] hw/core/loader: Fix possible crash in rom_copy() Date: Tue, 1 Oct 2019 12:50:56 +0200 Message-Id: <20191001105057.3949-5-thuth@redhat.com> In-Reply-To: <20191001105057.3949-1-thuth@redhat.com> References: <20191001105057.3949-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Tue, 01 Oct 2019 10:51:07 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org 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" Both, "rom->addr" and "addr" are derived from the binary image that can be loaded with the "-kernel" paramer. The code in rom_copy() then calculates: d =3D dest + (rom->addr - addr); and uses "d" as destination in a memcpy() some lines later. Now with bad kernel images, it is possible that rom->addr is smaller than addr, thus "rom->addr - addr" gets negative and the memcpy() then tries to copy contents from the image to a bad memory location. This could maybe be used to inject code from a kernel image into the QEMU binary, so we better fix it with an additional sanity check here. Cc: qemu-stable@nongnu.org Reported-by: Guangming Liu Buglink: https://bugs.launchpad.net/qemu/+bug/1844635 Message-Id: <20190925130331.27825-1-thuth@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Thomas Huth --- hw/core/loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/loader.c b/hw/core/loader.c index 0d60219364..5099f27dc8 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -1281,7 +1281,7 @@ int rom_copy(uint8_t *dest, hwaddr addr, size_t size) if (rom->addr + rom->romsize < addr) { continue; } - if (rom->addr > end) { + if (rom->addr > end || rom->addr < addr) { break; } =20 --=20 2.18.1 From nobody Wed Nov 12 08:34:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1569927386; cv=none; d=zoho.com; s=zohoarc; b=nIeOb/LXZQe7tNOQKRopqCKlhN4FCdbqyIxWbOFDmDE4Zj459OHQo2lNI0BEvq3Wn+FLHKmMy1XCpZiOiMMlNKf4HsGlhsSWCDlmUvLF8dX3AEoDGEF8Hs6ot/oQJ1EFMmStzWMqyPcxTmFdVqAJD4hztVivC0A/ojJAw4LfaBY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569927386; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=xLNmhREUeQ5pJkgHiYiBqHoRh8/dr2KPy1kkPSpPWKs=; b=kRXUEMCWmYEogZdFZQV0WiGV+kJwlxBoROZMDym83yBk3IRqD/QPMsarR7ryjZYFwEvm6jHEoFPgjf4BnJacOZOnvhcaIsxsxF8Mon8RD0WmvKYMxiywnqZOeEy5BFyFys1IQ8iNcsiauw8knWU7OYdTIlQ3/Iz6tGae7GJNSEM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569927386860603.2873967602183; Tue, 1 Oct 2019 03:56:26 -0700 (PDT) Received: from localhost ([::1]:40346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFFpR-0000jC-SV for importer@patchew.org; Tue, 01 Oct 2019 06:56:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51949) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFFkT-0003bE-NJ for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFFkO-0007Rh-9C for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48848) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFFkO-0007P1-3C for qemu-devel@nongnu.org; Tue, 01 Oct 2019 06:51:12 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 596DD81F25; Tue, 1 Oct 2019 10:51:08 +0000 (UTC) Received: from thuth.com (ovpn-116-70.ams2.redhat.com [10.36.116.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C3B6261A0; Tue, 1 Oct 2019 10:51:07 +0000 (UTC) From: Thomas Huth To: Peter Maydell Subject: [PULL 5/5] Disallow colons in the parameter of "-accel" Date: Tue, 1 Oct 2019 12:50:57 +0200 Message-Id: <20191001105057.3949-6-thuth@redhat.com> In-Reply-To: <20191001105057.3949-1-thuth@redhat.com> References: <20191001105057.3949-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 01 Oct 2019 10:51:08 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org 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" Everybody who used something like "-machine accel=3Dkvm:tcg" in the past might be tempted to specify a similar list with the -accel parameter, too, for example "-accel kvm:tcg". However, this is not how this options is thought to be used, since each "-accel" should only take care of one specific accelerator. In the long run, we really should rework the "-accel" code completely, so that it does not set "-machine accel=3D..." anymore internally, but is completely independent from "-machine". For the short run, let's make sure that users cannot use "-accel xyz:tcg", so that we avoid that we have to deal with such cases in the wild later. Message-Id: <20190930123505.11607-1-thuth@redhat.com> Signed-off-by: Thomas Huth --- tests/cdrom-test.c | 2 +- vl.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/cdrom-test.c b/tests/cdrom-test.c index 05611da648..34e9974634 100644 --- a/tests/cdrom-test.c +++ b/tests/cdrom-test.c @@ -120,7 +120,7 @@ static void test_cdboot(gconstpointer data) { QTestState *qts; =20 - qts =3D qtest_initf("-accel kvm:tcg -no-shutdown %s%s", (const char *)= data, + qts =3D qtest_initf("-M accel=3Dkvm:tcg -no-shutdown %s%s", (const cha= r *)data, isoimage); boot_sector_test(qts); qtest_quit(qts); diff --git a/vl.c b/vl.c index 630f5c5e9c..002bf4919e 100644 --- a/vl.c +++ b/vl.c @@ -3554,6 +3554,11 @@ int main(int argc, char **argv, char **envp) g_slist_free(accel_list); exit(0); } + if (optarg && strchr(optarg, ':')) { + error_report("Don't use ':' with -accel, " + "use -M accel=3D... for now instead"); + exit(1); + } opts =3D qemu_opts_create(qemu_find_opts("machine"), NULL, false, &error_abort); qemu_opt_set(opts, "accel", optarg, &error_abort); --=20 2.18.1