From nobody Sat Nov 23 18:18:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731962551; cv=none; d=zohomail.com; s=zohoarc; b=HNGtpeAI/zRsd6TOtEeASsEH+FOdBG2s/zGMQzbpm5vBWZn+HNb19E1ywzhIXwjfb+GF9nW4U7qdVSvm2tNL0BRumAXt9zruLcLXaI38CqI029Qace7TTuUai2sHDeRrotIzjHa87ZPZ+O+W/8vl2VVf89Q/XnbSIDC4FR5uunE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731962551; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=eHplRik/YcnR60UB43A7Gp9H2sYINST0OAHvGPPuMSA=; b=jfZMq8/g4YYcfr1Gjj7HmqqEwEjGbm0puj+q3iqM1lknTcCkhoKYeIzkVkLpZsr0plA4wV8pbWm284/HmytzElxmouVMAXbi7S0rbbmxjTwp+Ace9sfHqacIv54O9UDSR8ZPq5TxCHgnMbkFOqnvDaQvtUdxs0HdgYQftm/UjcU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731962551390559.0691005886621; Mon, 18 Nov 2024 12:42:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD8Ys-0001U9-62; Mon, 18 Nov 2024 15:41:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tD8Yq-0001Tq-F1 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 15:41:28 -0500 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD8Yo-0002NO-Hi for qemu-devel@nongnu.org; Mon, 18 Nov 2024 15:41:28 -0500 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5cfcb7183deso2202391a12.0 for ; Mon, 18 Nov 2024 12:41:25 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa20df56b1esm574306066b.71.2024.11.18.12.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 12:41:24 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 37DDB5F8E9; Mon, 18 Nov 2024 20:41:23 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731962484; x=1732567284; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eHplRik/YcnR60UB43A7Gp9H2sYINST0OAHvGPPuMSA=; b=acvYzKnbD+BXmYCUeI1WBKGIMbq0Bwzf7Yc3d8JtV1raLgYx97VNXeOpWj6JiJaYeH C7b/dcbuYBGfOtfgPFTV+WrRpvA6CCBBzKgpABzUYIj8t7RhQZISRmrHtAL7lGmT72JS bYa0bWvBBSsKMUK7C+K8D9DxDLfOVWkq9sT5pzdzc0oqDnFVcuMuUuSD+k+xT648TB2k gBzVA1HRx+bqVYDmPu5e5grGaC2NYRXn/OTo/mh4P6M7guc2X12fJO/E5LhpzUfOcFFW pO7ldWovVvyriHR3MexccP91y2ZLDfqFeJQ90LKlUDRur/N67vMqpj3kP/byHfr5LN9x +WGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731962484; x=1732567284; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eHplRik/YcnR60UB43A7Gp9H2sYINST0OAHvGPPuMSA=; b=UR86IOkPYbggMCVLPkwEZCXKvmrSop6QJ3AVbD1zMUkmsPUaxTCs4bz6grrQFNucTg GIo/7SDwKkcK/U8S7RCHUGVqqgBCIyv5nWxCkOjjXYood2Qe6mRk1LvVXNhLNCElxRjH InH57YTvey8dCojyANedNQDyLUFQe5x/EGek4g6vud9t5wTPhZIlv9ysk+9/3dIt2JjK 5GPHJRguoDuI1Bx+KG3WW/ZVrYpbfnFwxx14oE4GA7NFA+wU0er09iw1lKpRXuSMPfVa VDK01L1pWFg7P4idexJV9QMQRoV39BWBxZLP/GNIHABbSkL89UnQH7jOMizFwuQjSCoZ DM5g== X-Gm-Message-State: AOJu0Yxi8mLAXXplyJ0f8Nh2R7BfDH8b6kCM975Ry5+elWuNJojfMFPP i4kd/FrjQ4sDeop0raXktVj7R9lfqvxgtIlNfubIYi16/uMAgyffAtKHuhaDbeo= X-Google-Smtp-Source: AGHT+IHSZTPpMD1xwncPVNmStBGMBG/0LbJF37QW2VIFds0Bat3Vr/oKbEdnHgtRKiu0KWTRsRGQQA== X-Received: by 2002:a17:906:4fcb:b0:a9e:eee8:4947 with SMTP id a640c23a62f3a-aa4c7e256fbmr67195166b.9.1731962484533; Mon, 18 Nov 2024 12:41:24 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 1/4] tests/tcg: Stop using exit() in the gdbstub testcases Date: Mon, 18 Nov 2024 20:41:20 +0000 Message-Id: <20241118204123.3083310-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241118204123.3083310-1-alex.bennee@linaro.org> References: <20241118204123.3083310-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::535; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731962553205116600 From: Ilya Leoshkevich GDB 15 does not like exit() anymore: (gdb) python exit(0) Python Exception : 0 Error occurred in Python: 0 Use the GDB's own exit command, like it's already done in a couple places, everywhere. This is the same fix as commit 93a3048dcf45 ("tests: Gently exit from GDB when tests complete"), but applied to more places. Acked-by: Gustavo Romero Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Ilya Leoshkevich Message-Id: <20241022113939.19989-1-iii@linux.ibm.com> Signed-off-by: Alex Benn=C3=A9e diff --git a/tests/guest-debug/test_gdbstub.py b/tests/guest-debug/test_gdb= stub.py index a715c0e3f5..4f08089e6a 100644 --- a/tests/guest-debug/test_gdbstub.py +++ b/tests/guest-debug/test_gdbstub.py @@ -10,10 +10,16 @@ =20 fail_count =3D 0 =20 + +def gdb_exit(status): + gdb.execute(f"exit {status}") + + class arg_parser(argparse.ArgumentParser): def exit(self, status=3DNone, message=3D""): print("Wrong GDB script test argument! " + message) - gdb.execute("exit 1") + gdb_exit(1) + =20 def report(cond, msg): """Report success/fail of a test""" @@ -38,11 +44,11 @@ def main(test, expected_arch=3DNone): "connected to {}".format(expected_arch)) except (gdb.error, AttributeError): print("SKIP: not connected") - exit(0) + gdb_exit(0) =20 if gdb.parse_and_eval("$pc") =3D=3D 0: print("SKIP: PC not set") - exit(0) + gdb_exit(0) =20 try: test() @@ -62,4 +68,4 @@ def main(test, expected_arch=3DNone): pass =20 print("All tests complete: {} failures".format(fail_count)) - gdb.execute(f"exit {fail_count}") + gdb_exit(fail_count) diff --git a/tests/tcg/multiarch/gdbstub/interrupt.py b/tests/tcg/multiarch= /gdbstub/interrupt.py index 90a45b5140..2d5654d154 100644 --- a/tests/tcg/multiarch/gdbstub/interrupt.py +++ b/tests/tcg/multiarch/gdbstub/interrupt.py @@ -8,7 +8,7 @@ # =20 import gdb -from test_gdbstub import main, report +from test_gdbstub import gdb_exit, main, report =20 =20 def check_interrupt(thread): @@ -49,7 +49,7 @@ def run_test(): """ if len(gdb.selected_inferior().threads()) =3D=3D 1: print("SKIP: set to run on a single thread") - exit(0) + gdb_exit(0) =20 gdb.execute("set scheduler-locking on") for thread in gdb.selected_inferior().threads(): diff --git a/tests/tcg/multiarch/gdbstub/prot-none.py b/tests/tcg/multiarch= /gdbstub/prot-none.py index 7e264589cb..51082a30e4 100644 --- a/tests/tcg/multiarch/gdbstub/prot-none.py +++ b/tests/tcg/multiarch/gdbstub/prot-none.py @@ -5,7 +5,7 @@ SPDX-License-Identifier: GPL-2.0-or-later """ import ctypes -from test_gdbstub import main, report +from test_gdbstub import gdb_exit, main, report =20 =20 def probe_proc_self_mem(): @@ -22,7 +22,7 @@ def run_test(): """Run through the tests one by one""" if not probe_proc_self_mem(): print("SKIP: /proc/self/mem is not usable") - exit(0) + gdb_exit(0) gdb.Breakpoint("break_here") gdb.execute("continue") val =3D gdb.parse_and_eval("*(char[2] *)q").string() diff --git a/tests/tcg/multiarch/gdbstub/test-proc-mappings.py b/tests/tcg/= multiarch/gdbstub/test-proc-mappings.py index 0f687f3284..6eb6ebf7b1 100644 --- a/tests/tcg/multiarch/gdbstub/test-proc-mappings.py +++ b/tests/tcg/multiarch/gdbstub/test-proc-mappings.py @@ -3,7 +3,7 @@ This runs as a sourced script (via -x, via run-test.py).""" from __future__ import print_function import gdb -from test_gdbstub import main, report +from test_gdbstub import gdb_exit, main, report =20 =20 def run_test(): @@ -12,7 +12,7 @@ def run_test(): # m68k GDB supports only GDB_OSABI_SVR4, but GDB_OSABI_LINUX is # required for the info proc support (see set_gdbarch_info_proc()). print("SKIP: m68k GDB does not support GDB_OSABI_LINUX") - exit(0) + gdb_exit(0) mappings =3D gdb.execute("info proc mappings", False, True) report(isinstance(mappings, str), "Fetched the mappings from the infer= ior") # Broken with host page size > guest page size --=20 2.39.5 From nobody Sat Nov 23 18:18:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731962552; cv=none; d=zohomail.com; s=zohoarc; b=RmjCvcTBRpU3F/z+j6kCab27X+YFdpfPyu1nLC+XEIsRDHXggHWZPb4ffcbXEg+0tITDPZx/Cl6mQlyY6FzwJii7tKGpAhcm2DcSvljKncwy3zZLggx2jAaFHmj3UoqkkL2dLLjRdSIIBa635kzLrEFfuZHS10zQuw/dLRu2UIE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731962552; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XDyffl07CJF0M0DGgKE69bB4AQSjff6CC/++zS6LNmU=; b=CNKXDhZS0EY/t2WOrt3wIZ4FYrtSKKKJz6ZT7B3rehJTxttGnXt68ZwxVBl38E2Bg0pxcOLVVaNMaXAInb64zBd1/o9Nv+lmflIArkqDUP7DFdxC9qzpJ4lVnm7V9TWpXbiZhDBnpy0lNEfDtB3Bk5n9KRedu8Aw4X3e8zZ5LaA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731962552390440.24721581325707; Mon, 18 Nov 2024 12:42:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD8Yu-0001V8-5B; Mon, 18 Nov 2024 15:41:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tD8Ys-0001UO-F9 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 15:41:30 -0500 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD8Yq-0002O1-Jm for qemu-devel@nongnu.org; Mon, 18 Nov 2024 15:41:30 -0500 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-539f84907caso265056e87.3 for ; Mon, 18 Nov 2024 12:41:28 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cf79bb3a0asm5061085a12.39.2024.11.18.12.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 12:41:25 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 4C2505F915; Mon, 18 Nov 2024 20:41:23 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731962487; x=1732567287; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XDyffl07CJF0M0DGgKE69bB4AQSjff6CC/++zS6LNmU=; b=MucceMWXFDWRSYZOnucRAck6l8QQvibJJ9vF7WySamtuecX2B5f2AJpJMd/F9qyKIX Ad5QHNhnT8cTKavDTk2UuphaZg28iZC7nhAdZouxh6RAPY0jd8HQ9kFarhsOn0NaFLqv uXuVZMjBd9RJQppf6fs5Io8nvQKdIu+Q4GOn0f7WVZhwxBFgLS+l2CdTxeJ0p82Fx5Kj tKZaKHNOD8CH3Z0KCmM8F4x/xke+m3rWqdP4jEYt3Q3YFblD974wKbR2i6njktLm5NGC cwkNTm/A+uscEs/7KPYkMgUrg7hlZz+d299wdsD1wdLJ4uucpRfxK62YCfkga5GzNVOI 53DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731962487; x=1732567287; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XDyffl07CJF0M0DGgKE69bB4AQSjff6CC/++zS6LNmU=; b=SHT+qU93NyJsl/3JPzLdJUdJ+lnVJ4ThHb5rQdepwh4uGiZe5qmhGOuiTTAzPxKUGp Oym7+TMljOElpBPKPnEp2CR0zp9NxJKPSjplQUnRLiwOVYoTOMdzL1v0SyYQn7d51OWk 9DN/IzdWraDEJ5LfjAjpEnBKBG7iT9/5O/oHggX+gzFkccZuFU4M5UIOjRlLvGhLPVxs 9qg+l5wQ+JWWtoKd0Ea+i5+EhNss2/T2uWwWUJpBDpoXmsRnz3+4xXbCSsgvO42mV9tR jEecYGocjWoH7StAJdffbm20IoE6mlJnkXiMzk2gEW4vcqlL87itpkGrqTDHV9QYw2Rk +GBg== X-Gm-Message-State: AOJu0YyOeDW43YFQJTyK2TqIjy1QGmi8qPRY56TI2rX6+8z/Vz+M6oEh ijTp6JwrrOeCPvJ9Hpn0/fidKlZWd7Tjh6iD8xxbzlCYUOuz1DlB3ovGr4nrttg= X-Google-Smtp-Source: AGHT+IGGITJkspTspF+mpmMFEAsIYJYpwV43fOSBhBs4gaavK8jRBBNvjIgMbOxxTUO2WMUB3/hNEA== X-Received: by 2002:a05:6512:3ba1:b0:53b:1f90:576f with SMTP id 2adb3069b0e04-53dab2a6022mr6181408e87.22.1731962486821; Mon, 18 Nov 2024 12:41:26 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Manos Pitsidianakis , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 2/4] MAINTAINERS: CC rust/ patches to qemu-rust list Date: Mon, 18 Nov 2024 20:41:21 +0000 Message-Id: <20241118204123.3083310-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241118204123.3083310-1-alex.bennee@linaro.org> References: <20241118204123.3083310-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::12a; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x12a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731962553232116600 From: Manos Pitsidianakis As of Nov 2024 [1], we have a new topical mailing list for Rust related patches. Add a new MAINTAINERS entry to touch all files under rust/ subdirectory and additionally add it to previous rust related entries. [1] https://lore.kernel.org/qemu-devel/CAFEAcA-ZQuyGTtG-vhRTEwpz0L4cpimNxkK= ix45Yw6gVHXozRQ@mail.gmail.com Signed-off-by: Manos Pitsidianakis Message-Id: <20241109-update-maintainers-file-rust-v1-1-f4daba6f782f@linaro= .org> [AJB: tweak commit msg] Signed-off-by: Alex Benn=C3=A9e diff --git a/MAINTAINERS b/MAINTAINERS index 095420f8b0..373176e445 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3338,6 +3338,10 @@ F: rust/qemu-api F: rust/qemu-api-macros F: rust/rustfmt.toml =20 +Rust-related patches CC here +L: qemu-rust@nongnu.org +F: rust/ + SLIRP M: Samuel Thibault S: Maintained @@ -4241,6 +4245,7 @@ F: docs/devel/docs.rst =20 Rust build system integration M: Manos Pitsidianakis +L: qemu-rust@nongnu.org S: Maintained F: scripts/rust/ F: rust/.gitignore --=20 2.39.5 From nobody Sat Nov 23 18:18:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731962555; cv=none; d=zohomail.com; s=zohoarc; b=CgPEvegEhIjRicmcgOqrcdkXI3CGbd3xtMNx3vhrnYYu/pz3i0aSDMjV6ui1SEJj8yKX8rjlCwIOvpH9rQiUI3nNKSLf5ApfIbq3NYyKmLYQznASAlx7qY/OWj7UxmlFE96nd8M9DPqEFC4UWEVW01dfZW0+np1cxy8QhCB2DgE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731962555; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4kIdm3c5CRlQd1d9CckiYBUwnYKVwMrWkq3AMyJ9+Ic=; b=AyMi7hE/EEwHzcc5CbBVqIpMLi7RHfr63IXfU0y1Tb7RuNucyu9EfJH+oTaQOQMOOh2BdnMxassDqMJWCRBZtSaV0l97Qp5TOnrUGqXrfwCb9L0h6WanfHBL8xb8pAzXrLE0ETLYLH4feJtrJ6vZCmFynSTeQMeMsajonFOluBQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 173196255548398.22168158369504; Mon, 18 Nov 2024 12:42:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD8Yt-0001V2-N1; Mon, 18 Nov 2024 15:41:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tD8Yq-0001Tr-Hj for qemu-devel@nongnu.org; Mon, 18 Nov 2024 15:41:28 -0500 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD8Yo-0002Ne-JM for qemu-devel@nongnu.org; Mon, 18 Nov 2024 15:41:28 -0500 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a9ec86a67feso39575566b.1 for ; Mon, 18 Nov 2024 12:41:26 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa20df56b1esm574306166b.71.2024.11.18.12.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 12:41:24 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 650425F95B; Mon, 18 Nov 2024 20:41:23 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731962485; x=1732567285; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4kIdm3c5CRlQd1d9CckiYBUwnYKVwMrWkq3AMyJ9+Ic=; b=VYK7KJHxVqj2RxBJZdRstr7ivVeEMGE2/BRQr4e9rB+GMHZIUE9LIv0hLvzjUpUlXi RyVmoMFqQoOCEtqaZymqE4+HdUzOA8QhgfWvkmS06ExclfHdKchLG0bZEU4SfSbENTu4 Scb+olnZDvCqdIeE6kPTxE8XUAYH+Chy4WFociX7VySkj0kFDo6eQRB/kny11gMY283N xIEMA3h/pAb1BIdEzxiTrC+LrcYE4WOMMaTBgbVt4owr11wqG7nNEsaELnbIjLcirAMC PhBoVrPmamB0fV1MQySYPPkBJr5U4L0ERROWD4HSSJLnd78yCsqx73jKZ+1P3jHZXk2z h+0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731962485; x=1732567285; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4kIdm3c5CRlQd1d9CckiYBUwnYKVwMrWkq3AMyJ9+Ic=; b=wxbrlvMmhcQ+dwx8/hCPHiyFaryvccmsOXqkfAdsvHxOY7Yc44ndjoaDShV/YNCEcP 5G3viVFdJT4xqVdv25zYog1r0EXpi/SzD5RFwoOVFkyLAMH8x1Cz17UC+gLTi9r44DHd U4HoNTOh0cBmbwFLyFGdBnN8kmxi/Ajb6xWgQomERaYMDRnfcZ2l7HljTzj1H1VJ10KC ci3/TelMw+sFr23w9ucZ2LtraXL+Whx3IFdiddPxMnG4PLfJERDLBRKJe7wX0mQ29j3T QQTYvMo2+Jhw+OQ4Fno7sKlyP8p5tDGI14Si1duo9m7C4kUKCt3O2U+Az5MefA2B1udn V7kA== X-Gm-Message-State: AOJu0YyYioxjTlSvdC3AJN049WNhKFFQYWj17JhwqPLYyG3d/T76i99d 4d6+W68q93H0XwngaYxr+Ld2gHvuEYVW2qz4MYXglSbj2UeOCe9oAZBRjMsVXai01CgyEvo4biQ 4 X-Google-Smtp-Source: AGHT+IHpoF4FeRdYRUJ+9wLnZe/f4LOBxy+15QrlJ2fvAzQuCU9V8EnkkdoX/1tvnbe7cUhe2yjhXg== X-Received: by 2002:a17:906:9c82:b0:a99:fc9a:5363 with SMTP id a640c23a62f3a-aa4833f7a46mr1208173566b.9.1731962484893; Mon, 18 Nov 2024 12:41:24 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Dmitry Osipenko , "Michael S. Tsirkin" Subject: [PULL 3/4] hw/display: factor out the scanout blob to fb conversion Date: Mon, 18 Nov 2024 20:41:22 +0000 Message-Id: <20241118204123.3083310-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241118204123.3083310-1-alex.bennee@linaro.org> References: <20241118204123.3083310-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::629; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731962557069116600 There are two identical sequences of a code doing the same thing that raise warnings with Coverity. Before fixing those issues lets factor out the common code into a helper function we can share. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Signed-off-by: Alex Benn=C3=A9e Message-Id: <20241111230040.68470-2-alex.bennee@linaro.org> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 553799b8cc..924eb8737e 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -333,6 +333,21 @@ void virtio_gpu_update_cursor_data(VirtIOGPU *g, struct virtio_gpu_scanout *s, uint32_t resource_id); =20 +/** + * virtio_gpu_scanout_blob_to_fb() - fill out fb based on scanout data + * fb: the frame-buffer descriptor to fill out + * ss: the scanout blob data + * blob_size: size of scanout blob data + * + * This will check we have enough space for the frame taking into + * account that stride for all but the last line. + * + * Returns true on success, otherwise logs guest error and returns false + */ +bool virtio_gpu_scanout_blob_to_fb(struct virtio_gpu_framebuffer *fb, + struct virtio_gpu_set_scanout_blob *ss, + uint64_t blob_size); + /* virtio-gpu-udmabuf.c */ bool virtio_gpu_have_udmabuf(void); void virtio_gpu_init_udmabuf(struct virtio_gpu_simple_resource *res); diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index eedae7357f..145a0b3879 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -805,7 +805,6 @@ static void virgl_cmd_set_scanout_blob(VirtIOGPU *g, struct virtio_gpu_framebuffer fb =3D { 0 }; struct virtio_gpu_virgl_resource *res; struct virtio_gpu_set_scanout_blob ss; - uint64_t fbend; =20 VIRTIO_GPU_FILL_CMD(ss); virtio_gpu_scanout_blob_bswap(&ss); @@ -852,26 +851,7 @@ static void virgl_cmd_set_scanout_blob(VirtIOGPU *g, return; } =20 - fb.format =3D virtio_gpu_get_pixman_format(ss.format); - if (!fb.format) { - qemu_log_mask(LOG_GUEST_ERROR, "%s: pixel format not supported %d\= n", - __func__, ss.format); - cmd->error =3D VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; - return; - } - - fb.bytes_pp =3D DIV_ROUND_UP(PIXMAN_FORMAT_BPP(fb.format), 8); - fb.width =3D ss.width; - fb.height =3D ss.height; - fb.stride =3D ss.strides[0]; - fb.offset =3D ss.offsets[0] + ss.r.x * fb.bytes_pp + ss.r.y * fb.strid= e; - - fbend =3D fb.offset; - fbend +=3D fb.stride * (ss.r.height - 1); - fbend +=3D fb.bytes_pp * ss.r.width; - if (fbend > res->base.blob_size) { - qemu_log_mask(LOG_GUEST_ERROR, "%s: fb end out of range\n", - __func__); + if (!virtio_gpu_scanout_blob_to_fb(&fb, &ss, res->base.blob_size)) { cmd->error =3D VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; return; } diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index c0570ef856..e7ca8fd1cf 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -721,13 +721,48 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g, &fb, res, &ss.r, &cmd->error); } =20 +bool virtio_gpu_scanout_blob_to_fb(struct virtio_gpu_framebuffer *fb, + struct virtio_gpu_set_scanout_blob *ss, + uint64_t blob_size) +{ + uint64_t fbend; + + fb->format =3D virtio_gpu_get_pixman_format(ss->format); + if (!fb->format) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: host couldn't handle guest format %d\n", + __func__, ss->format); + return false; + } + + fb->bytes_pp =3D DIV_ROUND_UP(PIXMAN_FORMAT_BPP(fb->format), 8); + fb->width =3D ss->width; + fb->height =3D ss->height; + fb->stride =3D ss->strides[0]; + fb->offset =3D ss->offsets[0] + ss->r.x * fb->bytes_pp + ss->r.y * fb-= >stride; + + fbend =3D fb->offset; + fbend +=3D fb->stride * (ss->r.height - 1); + fbend +=3D fb->bytes_pp * ss->r.width; + + if (fbend > blob_size) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: fb end out of range\n", + __func__); + return false; + } + + return true; +} + + + static void virtio_gpu_set_scanout_blob(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cm= d) { struct virtio_gpu_simple_resource *res; struct virtio_gpu_framebuffer fb =3D { 0 }; struct virtio_gpu_set_scanout_blob ss; - uint64_t fbend; =20 VIRTIO_GPU_FILL_CMD(ss); virtio_gpu_scanout_blob_bswap(&ss); @@ -753,28 +788,7 @@ static void virtio_gpu_set_scanout_blob(VirtIOGPU *g, return; } =20 - fb.format =3D virtio_gpu_get_pixman_format(ss.format); - if (!fb.format) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: host couldn't handle guest format %d\n", - __func__, ss.format); - cmd->error =3D VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; - return; - } - - fb.bytes_pp =3D DIV_ROUND_UP(PIXMAN_FORMAT_BPP(fb.format), 8); - fb.width =3D ss.width; - fb.height =3D ss.height; - fb.stride =3D ss.strides[0]; - fb.offset =3D ss.offsets[0] + ss.r.x * fb.bytes_pp + ss.r.y * fb.strid= e; - - fbend =3D fb.offset; - fbend +=3D fb.stride * (ss.r.height - 1); - fbend +=3D fb.bytes_pp * ss.r.width; - if (fbend > res->blob_size) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: fb end out of range\n", - __func__); + if (!virtio_gpu_scanout_blob_to_fb(&fb, &ss, res->blob_size)) { cmd->error =3D VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; return; } --=20 2.39.5 From nobody Sat Nov 23 18:18:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731962555; cv=none; d=zohomail.com; s=zohoarc; b=LA90rbPsu7lBYzAz18CcqKfpXyOsZcy1oo9HQwWZmb3QClElIgGh2wZDDTKlTPMX44iwWimIEvotLcAbR0XsLNSqzxxUZneDOSGB4PPxyOONkYOgftEV3vxOFnmtB/xTaobHi6ESjVnwax1nuG7YjLFyOzk9wt6EaZeO6SXGzrQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731962555; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QUG5srLGbOrkRmSwQBWBypd2vcAod2ucdDn5wmB1EIo=; b=n9sGeiF3JBTdC1eBW7sjQhhV3ei7YZRwclxMIyjNUDT4CgFvRX8wN0g6nxmPvPl7BJBzVxWutBA90B8ksn36yd81kkGJ9FdPtQtRnSTjlREbcurTgQ7Cc8BORL7T8cGvHEukVKJhIexxxV4T0O00gxKjabqsNaMixGS/nyMPlsg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731962555005321.4350926775744; Mon, 18 Nov 2024 12:42:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD8Yt-0001V0-FZ; Mon, 18 Nov 2024 15:41:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tD8Yr-0001U7-WB for qemu-devel@nongnu.org; Mon, 18 Nov 2024 15:41:30 -0500 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD8Yp-0002Nh-69 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 15:41:29 -0500 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a9ed7d8d4e0so392625466b.1 for ; Mon, 18 Nov 2024 12:41:26 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa20e048f12sm573462566b.173.2024.11.18.12.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2024 12:41:24 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 7B9E25F95C; Mon, 18 Nov 2024 20:41:23 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731962485; x=1732567285; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QUG5srLGbOrkRmSwQBWBypd2vcAod2ucdDn5wmB1EIo=; b=KmJ/eriRwfiHvuYuMIb2s1HuIlU0gPpQJU4wTzabn42v5TH+COoC7LIZPmYEqdaHbZ kGFkAys5gvn9Fb0LI9a6RmiLo2NDlDlEeTCiXqmHQxGiDFVplRFnn38sc4hii+5AvE/e AjMb7726SAI9qNLY93pUXcKAjV0ICv1/EFcYCHwpImRkAD21imkqNRoIopauriwu1Q5Q 5gQxjDQdGyK7J5Wet+Mss2He7BZ5Qqjo2p8UWvQWJOWI+vH3dPZrM9GRgjIVAutNgZJ8 VjBlJwbnMy9VFHEJ8BOFcO7lhuRNVT7sc1oOId/a3p+IZs/ZednJsLr/u+Oc1f6QLcyZ Xn2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731962485; x=1732567285; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QUG5srLGbOrkRmSwQBWBypd2vcAod2ucdDn5wmB1EIo=; b=iBkgqs6n3LNRjEVuGSJuxS4g0CUDz0ds+XgSg9zNQxEUIwWdeJ2GG+SgieA0fCcpR7 MSqHbWF9MW55KIhA9RChGigP3280eAyXhmqN7uJQk+/nn8a/RhAxhqtRihaHnBB88JMX RZNDcAjgW1xN2tCgJJF7yjVQCHxt2YyhHD6dHmmrSNXDT7wUPlAILQjqoUejq35p9mBb HQDXiqiOeZC8l4BqD1PpA3bZqwglNprRi2PPzA7PcQgTlIbVpCJcuSjDoISNP31W7mAI RE8Jy5KHit4hCpiqaQVrwAk8v3YodhSRaoH51bYIVTUvuhMIcGCgdWkYM95wcOCGvI8+ c70w== X-Gm-Message-State: AOJu0YyOUX/RpjUPgTMsvVmD6PqTipx/EoM2b52rkY206Cpg9d/puTWJ PlHQ/clDAqL09Zc7VT54zRRgyWVO/jCsWXAJ21IEkLB+pSDtaP4Z8xAepXhXveE= X-Google-Smtp-Source: AGHT+IEKhYYQG+6IYcN7WCUXjVfxvXcQTuG/swUYF/HaN2yXO3AMY9tCRX9IK//ahbi12jnqVO2/kQ== X-Received: by 2002:a17:906:fe08:b0:a9a:85b5:2aba with SMTP id a640c23a62f3a-aa48341f3bamr1329130266b.21.1731962485227; Mon, 18 Nov 2024 12:41:25 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Dmitry Osipenko , "Michael S. Tsirkin" Subject: [PULL 4/4] hw/display: check frame buffer can hold blob Date: Mon, 18 Nov 2024 20:41:23 +0000 Message-Id: <20241118204123.3083310-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241118204123.3083310-1-alex.bennee@linaro.org> References: <20241118204123.3083310-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::62b; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1731962556931116600 Coverity reports (CID 1564769, 1564770) that we potentially overflow by doing some 32x32 multiplies for something that ends up in a 64 bit value. Fix this by first using stride for all lines and casting input to uint64_t to ensure a 64 bit multiply is used. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Signed-off-by: Alex Benn=C3=A9e Message-Id: <20241111230040.68470-3-alex.bennee@linaro.org> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 924eb8737e..8c977beebd 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -340,7 +340,7 @@ void virtio_gpu_update_cursor_data(VirtIOGPU *g, * blob_size: size of scanout blob data * * This will check we have enough space for the frame taking into - * account that stride for all but the last line. + * account that stride. * * Returns true on success, otherwise logs guest error and returns false */ diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index e7ca8fd1cf..7d22d03bbf 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -742,8 +742,7 @@ bool virtio_gpu_scanout_blob_to_fb(struct virtio_gpu_fr= amebuffer *fb, fb->offset =3D ss->offsets[0] + ss->r.x * fb->bytes_pp + ss->r.y * fb-= >stride; =20 fbend =3D fb->offset; - fbend +=3D fb->stride * (ss->r.height - 1); - fbend +=3D fb->bytes_pp * ss->r.width; + fbend +=3D (uint64_t) fb->stride * ss->r.height; =20 if (fbend > blob_size) { qemu_log_mask(LOG_GUEST_ERROR, --=20 2.39.5