From nobody Mon Feb 9 03:00:08 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1590091069; cv=none; d=zohomail.com; s=zohoarc; b=C4zxG50ZeGy7zhAvhMEPFtlbVVoqq+3LOKs/3l5fPwrdRRONpBKyRejeYU3KkrjNOKVhSEdVTuEAARldwpxK9k01x97Qm/HeXE9bR9xnZ4ZtMqnNeEe2AcjHwIQd9bj6qjV4VhCJPqzRLAd3ziWHfWrsl63yOkzzUSKmpAXM60M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590091069; 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; bh=zJkvLLRZJFXuNb2RdvRFoe6AFvm752P4m+bsAvqda5s=; b=h5/0JEUgobzrs/Y2LZxrx1ubCDWBe4rUoHayn6vMYPxXca5fOuOEXa32PrOs1lKHiITWDsfZA+SkITqdzDyd1lV8yvFHsUX/mxHwo90En1AgXSrPgDGU8mLXu47LYNBV7ogoKmrAog/lif4EaUCYAV+ZJSzr7kLCeSPziUD4xfU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590091069427263.9137228981333; Thu, 21 May 2020 12:57:49 -0700 (PDT) Received: from localhost ([::1]:38316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbrK8-0001l7-9E for importer@patchew.org; Thu, 21 May 2020 15:57:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbrGP-0002DY-Pa for qemu-devel@nongnu.org; Thu, 21 May 2020 15:53:57 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:46603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbrGN-0007af-6v for qemu-devel@nongnu.org; Thu, 21 May 2020 15:53:57 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id D9496748DD8; Thu, 21 May 2020 21:53:43 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 54B22746307; Thu, 21 May 2020 21:53:43 +0200 (CEST) Message-Id: <305af87f59d81e92f2aaff09eb8a3603b8baa322.1590089984.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v2 1/7] sm501: Convert printf + abort to qemu_log_mask Date: Thu, 21 May 2020 21:39:44 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org X-Spam-Probability: 8% Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: Peter Maydell , Sebastian Bauer , Magnus Damm , Gerd Hoffmann , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Some places already use qemu_log_mask() to log unimplemented features or errors but some others have printf() then abort(). Convert these to qemu_log_mask() and avoid aborting to prevent guests to easily cause denial of service. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/display/sm501.c | 57 ++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index acc692531a..bd3ccfe311 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -727,8 +727,8 @@ static void sm501_2d_operation(SM501State *s) int fb_len =3D get_width(s, crt) * get_height(s, crt) * get_bpp(s, crt= ); =20 if (addressing !=3D 0x0) { - printf("%s: only XY addressing is supported.\n", __func__); - abort(); + qemu_log_mask(LOG_UNIMP, "sm501: only XY addressing is supported.\= n"); + return; } =20 if (rop_mode =3D=3D 0) { @@ -754,8 +754,8 @@ static void sm501_2d_operation(SM501State *s) =20 if ((s->twoD_source_base & 0x08000000) || (s->twoD_destination_base & 0x08000000)) { - printf("%s: only local memory is supported.\n", __func__); - abort(); + qemu_log_mask(LOG_UNIMP, "sm501: only local memory is supported.\n= "); + return; } =20 switch (operation) { @@ -823,9 +823,9 @@ static void sm501_2d_operation(SM501State *s) break; =20 default: - printf("non-implemented SM501 2D operation. %d\n", operation); - abort(); - break; + qemu_log_mask(LOG_UNIMP, "sm501: not implemented 2D operation: %d\= n", + operation); + return; } =20 if (dst_base >=3D get_fb_addr(s, crt) && @@ -892,9 +892,8 @@ static uint64_t sm501_system_config_read(void *opaque, = hwaddr addr, break; =20 default: - printf("sm501 system config : not implemented register read." - " addr=3D%x\n", (int)addr); - abort(); + qemu_log_mask(LOG_UNIMP, "sm501: not implemented system config" + "register read. addr=3D%" HWADDR_PRIx "\n", addr); } =20 return ret; @@ -948,15 +947,15 @@ static void sm501_system_config_write(void *opaque, h= waddr addr, break; case SM501_ENDIAN_CONTROL: if (value & 0x00000001) { - printf("sm501 system config : big endian mode not implemented.= \n"); - abort(); + qemu_log_mask(LOG_UNIMP, "sm501: system config big endian mode= not" + " implemented.\n"); } break; =20 default: - printf("sm501 system config : not implemented register write." - " addr=3D%x, val=3D%x\n", (int)addr, (uint32_t)value); - abort(); + qemu_log_mask(LOG_UNIMP, "sm501: not implemented system config" + "register write. addr=3D%" HWADDR_PRIx + ", val=3D%" PRIx64 "\n", addr, value); } } =20 @@ -1207,9 +1206,8 @@ static uint64_t sm501_disp_ctrl_read(void *opaque, hw= addr addr, break; =20 default: - printf("sm501 disp ctrl : not implemented register read." - " addr=3D%x\n", (int)addr); - abort(); + qemu_log_mask(LOG_UNIMP, "sm501: not implemented disp ctrl registe= r " + "read. addr=3D%" HWADDR_PRIx "\n", addr); } =20 return ret; @@ -1345,9 +1343,9 @@ static void sm501_disp_ctrl_write(void *opaque, hwadd= r addr, break; =20 default: - printf("sm501 disp ctrl : not implemented register write." - " addr=3D%x, val=3D%x\n", (int)addr, (unsigned)value); - abort(); + qemu_log_mask(LOG_UNIMP, "sm501: not implemented disp ctrl registe= r " + "write. addr=3D%" HWADDR_PRIx + ", val=3D%" PRIx64 "\n", addr, value); } } =20 @@ -1433,9 +1431,8 @@ static uint64_t sm501_2d_engine_read(void *opaque, hw= addr addr, ret =3D 0; /* Should return interrupt status */ break; default: - printf("sm501 disp ctrl : not implemented register read." - " addr=3D%x\n", (int)addr); - abort(); + qemu_log_mask(LOG_UNIMP, "sm501: not implemented disp ctrl registe= r " + "read. addr=3D%" HWADDR_PRIx "\n", addr); } =20 return ret; @@ -1520,9 +1517,9 @@ static void sm501_2d_engine_write(void *opaque, hwadd= r addr, /* ignored, writing 0 should clear interrupt status */ break; default: - printf("sm501 2d engine : not implemented register write." - " addr=3D%x, val=3D%x\n", (int)addr, (unsigned)value); - abort(); + qemu_log_mask(LOG_UNIMP, "sm501: not implemented 2d engine registe= r " + "write. addr=3D%" HWADDR_PRIx + ", val=3D%" PRIx64 "\n", addr, value); } } =20 @@ -1670,9 +1667,9 @@ static void sm501_update_display(void *opaque) draw_line =3D draw_line32_funcs[dst_depth_index]; break; default: - printf("sm501 update display : invalid control register value.\n"); - abort(); - break; + qemu_log_mask(LOG_GUEST_ERROR, "sm501: update display" + "invalid control register value.\n"); + return; } =20 /* set up to draw hardware cursor */ --=20 2.21.3