From patchwork Sat Aug 1 13:13:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 277204 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9C84C433DF for ; Sat, 1 Aug 2020 13:25:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AE0992083E for ; Sat, 1 Aug 2020 13:25:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=gmx.net header.i=@gmx.net header.b="JsOnwzCM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AE0992083E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k1rVu-0002ss-QY for qemu-devel@archiver.kernel.org; Sat, 01 Aug 2020 09:25:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1rL7-0006J1-7a for qemu-devel@nongnu.org; Sat, 01 Aug 2020 09:14:17 -0400 Received: from mout.gmx.net ([212.227.15.15]:48675) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1rL4-0003wN-KP for qemu-devel@nongnu.org; Sat, 01 Aug 2020 09:14:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1596287640; bh=z/QXmt5sYC3nu5t+U0TkgIU+Re5QzTPu4ajnWt9P04Y=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=JsOnwzCMLFubOcJCP/NrCpN3GAqjOCQ+SJV1D9vIlgGfRlRzlO3aWj6GZC92YOg9h fHZrbegE9+Xicng7qwIwXFhzK3Mk+gnnnK7ku8udeWazi45e6aNOT0yu4Why/bQ6lC oFI2JHi6CD96ty+FpPYTTd5F3R+n+IWcrMtLuGhs= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from ls3530.fritz.box ([92.116.162.176]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MwQXH-1krM3e4B2z-00sNtn; Sat, 01 Aug 2020 15:14:00 +0200 From: Helge Deller To: qemu-devel@nongnu.org, peter.maydell@linaro.org Subject: [PATCH v2 3/4] hw/hppa: Implement proper SeaBIOS version check Date: Sat, 1 Aug 2020 15:13:56 +0200 Message-Id: <20200801131357.17379-4-deller@gmx.de> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200801131357.17379-1-deller@gmx.de> References: <20200801131357.17379-1-deller@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:6It3oYSTgvBrkeZ0GZ1B+fg3jkiUFwT4B3di5YYXEsEUmd3D8YF NJluS06+Et0dl5O6MZoXEb7nKy+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ZECE8RtrI1 Mpx45IQkRRuvdBSyoHINvqvcNdsVDQok8GaO8MFKdSNmHYsu6MwN79VUYbE9zLU4yDkjB2m0+ yrQC/Jx+LqBjuyDtDq5xbkMCe7e6OvEy5ximIRGqeckJdBDN0E9aNAutKnIExTV/9kzDdnK47 fNGWVxughdTKU4SKZvtMrwCm2a6wD/PlwHfJIeBGDgUiyn+LcnaUJnuooQ0pWRdetqVlHmHLJ 6ayghR+FV2S/FhPjQ8u0fADfShmbLP/Zw/OR9aGxuSvt6wE2J5LC3Q9pi89hMGiXc1Pu5mp5T U9x34GSMrf4A7PUF6isRYVs2uPOkHW3k2R0blDnpUFxwPLJxbT2uUs0Q7FypZd2v1sURK9MXR 2Cbc4qDOyMugxW9z9 Received-SPF: pass client-ip=212.227.15.15; envelope-from=deller@gmx.de; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/01 09:14:03 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Helge Deller , Richard Henderson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" It's important that the SeaBIOS hppa firmware is at least at a minimal level to ensure proper interaction between qemu and firmware. Implement a proper firmware version check by telling SeaBIOS via the fw_cfg interface which minimal SeaBIOS version is required by this running qemu instance. If the firmware detects that it's too old, it will stop. Signed-off-by: Helge Deller --- hw/hppa/machine.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) -- 2.21.3 diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 49155537cd..90aeefe2a4 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -25,6 +25,8 @@ #define MAX_IDE_BUS 2 +#define MIN_SEABIOS_HPPA_VERSION 1 /* require at least this fw version */ + static ISABus *hppa_isa_bus(void) { ISABus *isa_bus; @@ -56,6 +58,23 @@ static uint64_t cpu_hppa_to_phys(void *opaque, uint64_t addr) static HPPACPU *cpu[HPPA_MAX_CPUS]; static uint64_t firmware_entry; +static FWCfgState *create_fw_cfg(MachineState *ms) +{ + FWCfgState *fw_cfg; + uint64_t val; + + fw_cfg = fw_cfg_init_mem(QEMU_FW_CFG_IO_BASE, QEMU_FW_CFG_IO_BASE + 4); + fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, ms->smp.cpus); + fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, HPPA_MAX_CPUS); + fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, ram_size); + + val = cpu_to_le64(MIN_SEABIOS_HPPA_VERSION); + fw_cfg_add_file(fw_cfg, "/etc/firmware-min-version", + g_memdup(&val, sizeof(val)), sizeof(val)); + + return fw_cfg; +} + static void machine_hppa_init(MachineState *machine) { const char *kernel_filename = machine->kernel_filename; @@ -118,6 +137,9 @@ static void machine_hppa_init(MachineState *machine) 115200, serial_hd(0), DEVICE_BIG_ENDIAN); } + /* fw_cfg configuration interface */ + create_fw_cfg(machine); + /* SCSI disk setup. */ dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a")); lsi53c8xx_handle_legacy_cmdline(dev); From patchwork Sat Aug 1 13:13:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 277205 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 869F2C433E0 for ; Sat, 1 Aug 2020 13:17:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 53A622087C for ; Sat, 1 Aug 2020 13:17:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=gmx.net header.i=@gmx.net header.b="I6Plpe41" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53A622087C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k1rOA-00084C-8g for qemu-devel@archiver.kernel.org; Sat, 01 Aug 2020 09:17:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1rKy-0006B9-KU for qemu-devel@nongnu.org; Sat, 01 Aug 2020 09:14:08 -0400 Received: from mout.gmx.net ([212.227.15.15]:53951) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1rKw-0003uI-Pv for qemu-devel@nongnu.org; Sat, 01 Aug 2020 09:14:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1596287640; bh=etFg3+StLqfzOdelI3cESVmOqkDQ4a3cmEicqnLG+gk=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=I6Plpe41XhT2Ylyk1hTzrboFSkra1t7ozgP08h6+yDEVJaE6PWudDLEpNjRtYP7a8 vxjpiquzf8GZ9mHr13qww+DcJ1m2czn5sV0ANJGQihpEfbfvhderG9zyVpDumMbM5a C8QqGsPxgcQ5lV3wlUv3mMB4vYDBZUB7iJ26HRNo= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from ls3530.fritz.box ([92.116.162.176]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MGz1V-1jxiTT0jMh-00E4oT; Sat, 01 Aug 2020 15:14:00 +0200 From: Helge Deller To: qemu-devel@nongnu.org, peter.maydell@linaro.org Subject: [PATCH v2 4/4] hw/display/artist.c: fix out of bounds check Date: Sat, 1 Aug 2020 15:13:57 +0200 Message-Id: <20200801131357.17379-5-deller@gmx.de> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200801131357.17379-1-deller@gmx.de> References: <20200801131357.17379-1-deller@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:njv7tqexMyNbrMNn86E9YFp9RkiX30uhc2lvd+KK+I3KjEz5ct6 Hyk4NdkEsxdXnNUBSOEkSp+g94cdiAY0I6IAnRjQF8FcQwZTWo1fimi52rmNQBSJZVEwRLR El0tU3RCPpwCGGb0NIfgY8DkCgk3Q8tQW/UeNVM2uOHV6KBhpAiBmLSXiMdxG3I2LSwpJhV 5sqPt8EipOM//8Rxu0sZw== X-UI-Out-Filterresults: notjun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RHR+nD Cs2yvyv6W6EhBGmeKLwVXXTboIllj4ywUydRHVhYgqtjiUwsRy2cSDJhAPSDsmat++M3Ysn32 vlH9LWhB8hBdmjQgojMTvqLvCBzRISlkI1dWcGfe1Q54DslB3FOYO2FqbzdEBgQPX+KvbsrcI XxMmtoYfjmY5OqhuXONXPqcXRAhtNqaZxM2SXVoqDzs6amoYSZAGYzIdonzepD0VT6K27raaw R2LqXApe1m7Ho0/KP Received-SPF: pass client-ip=212.227.15.15; envelope-from=deller@gmx.de; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/01 09:14:03 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Helge Deller , Sven Schnelle , Richard Henderson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Sven Schnelle Signed-off-by: Sven Schnelle Signed-off-by: Helge Deller --- hw/display/artist.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) -- 2.21.3 diff --git a/hw/display/artist.c b/hw/display/artist.c index 6261bfe65b..de56200dbf 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -340,14 +340,13 @@ static void vram_bit_write(ARTISTState *s, int posx, int posy, bool incr_x, { struct vram_buffer *buf; uint32_t vram_bitmask = s->vram_bitmask; - int mask, i, pix_count, pix_length, offset, height, width; + int mask, i, pix_count, pix_length, offset, width; uint8_t *data8, *p; pix_count = vram_write_pix_per_transfer(s); pix_length = vram_pixel_length(s); buf = vram_write_buffer(s); - height = buf->height; width = buf->width; if (s->cmap_bm_access) { @@ -367,13 +366,6 @@ static void vram_bit_write(ARTISTState *s, int posx, int posy, bool incr_x, pix_count = size * 8; } - if (posy * width + posx + pix_count > buf->size) { - qemu_log("write outside bounds: wants %dx%d, max size %dx%d\n", - posx, posy, width, height); - return; - } - - switch (pix_length) { case 0: if (s->image_bitmap_op & 0x20000000) { @@ -381,8 +373,11 @@ static void vram_bit_write(ARTISTState *s, int posx, int posy, bool incr_x, } for (i = 0; i < pix_count; i++) { - artist_rop8(s, p + offset + pix_count - 1 - i, - (data & 1) ? (s->plane_mask >> 24) : 0); + uint32_t off = offset + pix_count - 1 - i; + if (off < buf->size) { + artist_rop8(s, p + off, + (data & 1) ? (s->plane_mask >> 24) : 0); + } data >>= 1; } memory_region_set_dirty(&buf->mr, offset, pix_count); @@ -398,7 +393,10 @@ static void vram_bit_write(ARTISTState *s, int posx, int posy, bool incr_x, for (i = 3; i >= 0; i--) { if (!(s->image_bitmap_op & 0x20000000) || s->vram_bitmask & (1 << (28 + i))) { - artist_rop8(s, p + offset + 3 - i, data8[ROP8OFF(i)]); + uint32_t off = offset + 3 - i; + if (off < buf->size) { + artist_rop8(s, p + off, data8[ROP8OFF(i)]); + } } } memory_region_set_dirty(&buf->mr, offset, 3); @@ -420,7 +418,7 @@ static void vram_bit_write(ARTISTState *s, int posx, int posy, bool incr_x, break; } - for (i = 0; i < pix_count; i++) { + for (i = 0; i < pix_count && offset + i < buf->size; i++) { mask = 1 << (pix_count - 1 - i); if (!(s->image_bitmap_op & 0x20000000) ||