From patchwork Mon Mar 11 19:12:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779436 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1690364wrt; Mon, 11 Mar 2024 12:22:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUZGOTnjqAeAjL3KfXgei74lshNpy40/VwczsiSX+TBmu307mqoPSXWxvNzMDMTh7RHw1530mQlilhPc09sulDs X-Google-Smtp-Source: AGHT+IFoDc7fbNDnfHsYnHkiSgX90CSuctVG6LnPRCxoOhZ+R+S6S0AjFV4lvXhk7Odjp5PbLyfm X-Received: by 2002:a05:622a:1309:b0:42e:aa53:9d31 with SMTP id v9-20020a05622a130900b0042eaa539d31mr10730516qtk.26.1710184946683; Mon, 11 Mar 2024 12:22:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184946; cv=none; d=google.com; s=arc-20160816; b=AytOm37x3cBfoR6v29Sx9cst1aJwQLg9YBYzpambE+XEyg/e7yWf5zojjISqb2kbUS 8825lULUmHThHWUYRE+JLdvffzjJWfGzxqE9+qS+nyuiuWRkb4ghe8VRVOCBa421djRg vwwkPzZq8/6fhKsQbEX7mhGCLaaoH2sa58M6mpo31N8a357A7m4Vo0cVWGV4fdaU4bJb MHL8kES/XzCtfr6JZCPTA2Kpgl2/NVhHi7aq+wIs0YzLn7+Ytf/vUh7p4nDUpqHRfANL oz6WZ7FxDv0EmBG+EfAnk+ToVWv/96QhG2E+OR4/tMAW0LElidv/cMTw1F0N0aGUh6Eo LfRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=zA+7vGcCZSBpL/CfvBeZ5mq0z2pduOK8cD9pB8ojouU=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=FuC9+vmvEsnDev8mkWCj/GcY1MQEMbUgzpyiq1n/+Nem+Tb8H3Y0ckuBqUOACGmUID bDe8YVBZ7j/3ANlOifPo7/IMsFeXowRsx+CjHDn3PJha5CR/3wVPYEx59YD2vdzipYbG oUt3kua7dyVf1eXXNeKK3p3p/3BoRm9lYFsmcyclTTl47/Ch5qM4Zz3laIJ2veQI8ac4 f+WXF6R8ZajYxA5F7ntAxD5QtXhc06AEt7pCgl/A06yAKdF6Suj4lg2DeaL9b4ujIWtE U5uE/MN9bn3XBDJ9W2xWMdN9tNMI+aNMYCWNRdGEuloG0dM0+BAwpF8a5ykCCoBCZurH dKSw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="y/8fuwwh"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f9-20020ac85d09000000b0042edc7a456esi6212470qtx.116.2024.03.11.12.22.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:22:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="y/8fuwwh"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl8d-0005yH-L2; Mon, 11 Mar 2024 15:16:53 -0400 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 1rjl4p-0003D1-MN for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:51 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4n-0000Lj-CP for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:47 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4132e548343so5407175e9.1 for ; Mon, 11 Mar 2024 12:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184363; x=1710789163; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=zA+7vGcCZSBpL/CfvBeZ5mq0z2pduOK8cD9pB8ojouU=; b=y/8fuwwhNmAz5Xvk+C3xpdYWvrmwXN9NZnFPkJ/uQ/Y9gnX123VDtbUIDbE3bPT47n uLI7OLVefVMlFS23jjVXa0tsJ7Qld8nGqgiP1uxWrmAkpot8nxn/RiQ8OZTwxiOVTHmL rgXzafjZMPBJyR25MI5RS2OR56eB8vAFShoI607BOAQ2gdqPYLrzZBD7BpKs1kEK0QKl filw1BRinUdYv8S1E3iml1xljikbhoxv0Gft6Ku0R2VMiXBN4hrUQpAQIInZNaF6SOjZ jXX9EK6xLb4aH3IOgvyMIBlN52qmwOhPVrZxGPLy+Gf84rWrD781Sh8O+XlGQ9Q0fnwf uzHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184363; x=1710789163; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zA+7vGcCZSBpL/CfvBeZ5mq0z2pduOK8cD9pB8ojouU=; b=WZTIP1QhIf3p8Tixz/huRgtsjWGpEIzpmHWB1KZp/ofefGkWFqsbZEKPEiCsXTc2Z6 jrotrWnBjmn55mCnmFYna9pdh1ocm7UDg6qvt5akr0TNVOgdChJR4D0SSNvTyer8g2tK FPxrHGKJ0UDu9vrsHZ4qEq/t7PqeBH/jCtEev3OjrzVBd0qJhX74N4uxmUHhFMHyQURs agsEUHzJv1Is9+ombFORMo/RIMv+6CP8n+cbOqhwYJUc6S3soGX8kF1AlMyeji/W9/Nl 2yw0LZ+kUdJEj7GfQYvF+HbtFAme3rYJOLcv4HovLDEpIsWvpPx39km1o8POKz+pTNfa +eAw== X-Gm-Message-State: AOJu0YzrwIYG39zEj0H19s6QzdW8I/DbGvgAFVxEg/AskpzTYkcU8uAq QNHnt9w60AtzqlLN1EaaJaLtyYTgvYieGBmCOKvDWUcjQP/A44I5T2/k3mi8duiGy2FnmTunIVE a X-Received: by 2002:a05:600c:190c:b0:413:1139:3bec with SMTP id j12-20020a05600c190c00b0041311393becmr5211402wmq.35.1710184362973; Mon, 11 Mar 2024 12:12:42 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:42 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/20] hw/arm: Deprecate various old Arm machine types Date: Mon, 11 Mar 2024 19:12:22 +0000 Message-Id: <20240311191241.4177990-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org QEMU includes some models of old Arm machine types which are a bit problematic for us because: * they're written in a very old way that uses numerous APIs that we would like to get away from (eg they don't use qdev, they use qemu_system_reset_request(), they use vmstate_register(), etc) * they've been that way for a decade plus and nobody particularly has stepped up to try to modernise the code (beyond some occasional work here and there) * we often don't have test cases for them, which means that if we do try to do the necessary refactoring work on them we have no idea if they even still work at all afterwards All these machine types are also of hardware that has largely passed away into history and where I would not be surprised to find that e.g. the Linux kernel support was never tested on real hardware any more. After some consultation with the Linux kernel developers, we are going to deprecate: All PXA2xx machines: akita Sharp SL-C1000 (Akita) PDA (PXA270) borzoi Sharp SL-C3100 (Borzoi) PDA (PXA270) connex Gumstix Connex (PXA255) mainstone Mainstone II (PXA27x) spitz Sharp SL-C3000 (Spitz) PDA (PXA270) terrier Sharp SL-C3200 (Terrier) PDA (PXA270) tosa Sharp SL-6000 (Tosa) PDA (PXA255) verdex Gumstix Verdex Pro XL6P COMs (PXA270) z2 Zipit Z2 (PXA27x) All OMAP2 machines: n800 Nokia N800 tablet aka. RX-34 (OMAP2420) n810 Nokia N810 tablet aka. RX-44 (OMAP2420) One of the OMAP1 machines: cheetah Palm Tungsten|E aka. Cheetah PDA (OMAP310) Rationale: * for QEMU dropping individual machines is much less beneficial than if we can drop support for an entire SoC * the OMAP2 QEMU code in particular is large, old and unmaintained, and none of the OMAP2 kernel maintainers said they were using QEMU in any of their testing/development * although there is a setup that is booting test kernels on some of the PXA2xx machines, nobody seemed to be using them as part of their active kernel development and my impression from the email thread is that PXA is the closest of all these SoC families to being dropped from the kernel soon * nobody said they were using cheetah, so it's entirely untested and quite probably broken * on the other hand the OMAP1 sx1 model does seem to be being used as part of kernel development, and there was interest in keeping collie around In particular, the mainstone, tosa and z2 machine types have already been dropped from Linux. Mark all these machine types as deprecated. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Message-id: 20240308171621.3749894-1-peter.maydell@linaro.org --- docs/about/deprecated.rst | 15 +++++++++++++++ hw/arm/gumstix.c | 2 ++ hw/arm/mainstone.c | 1 + hw/arm/nseries.c | 2 ++ hw/arm/palm.c | 1 + hw/arm/spitz.c | 1 + hw/arm/tosa.c | 1 + hw/arm/z2.c | 1 + 8 files changed, 24 insertions(+) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index dfd681cd024..0d074d1b29b 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -245,6 +245,21 @@ to correct issues, mostly regarding migration compatibility. These are no longer maintained and removing them will make the code easier to read and maintain. Use versions 2.12 and above as a replacement. +Arm machines ``akita``, ``borzoi``, ``cheetah``, ``connex``, ``mainstone``, ``n800``, ``n810``, ``spitz``, ``terrier``, ``tosa``, ``verdex``, ``z2`` (since 9.0) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +QEMU includes models of some machine types where the QEMU code that +emulates their SoCs is very old and unmaintained. This code is now +blocking our ability to move forward with various changes across +the codebase, and over many years nobody has been interested in +trying to modernise it. We don't expect any of these machines to have +a large number of users, because they're all modelling hardware that +has now passed away into history. We are therefore dropping support +for all machine types using the PXA2xx and OMAP2 SoCs. We are also +dropping the ``cheetah`` OMAP1 board, because we don't have any +test images for it and don't know of anybody who does; the ``sx1`` +and ``sx1-v1`` OMAP1 machines remain supported for now. + Backend options --------------- diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c index d5de5409e17..91462691531 100644 --- a/hw/arm/gumstix.c +++ b/hw/arm/gumstix.c @@ -106,6 +106,7 @@ static void connex_class_init(ObjectClass *oc, void *data) mc->desc = "Gumstix Connex (PXA255)"; mc->init = connex_init; mc->ignore_memory_transaction_failures = true; + mc->deprecation_reason = "machine is old and unmaintained"; } static const TypeInfo connex_type = { @@ -121,6 +122,7 @@ static void verdex_class_init(ObjectClass *oc, void *data) mc->desc = "Gumstix Verdex Pro XL6P COMs (PXA270)"; mc->init = verdex_init; mc->ignore_memory_transaction_failures = true; + mc->deprecation_reason = "machine is old and unmaintained"; mc->default_cpu_type = ARM_CPU_TYPE_NAME("pxa270-c0"); } diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c index d2e2e68aa3f..3a6c22fddbc 100644 --- a/hw/arm/mainstone.c +++ b/hw/arm/mainstone.c @@ -169,6 +169,7 @@ static void mainstone2_machine_init(MachineClass *mc) mc->init = mainstone_init; mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("pxa270-c5"); + mc->deprecation_reason = "machine is old and unmaintained"; } DEFINE_MACHINE("mainstone", mainstone2_machine_init) diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index 35deb74f655..35364312c73 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -1430,6 +1430,7 @@ static void n800_class_init(ObjectClass *oc, void *data) /* Actually two chips of 0x4000000 bytes each */ mc->default_ram_size = 0x08000000; mc->default_ram_id = "omap2.dram"; + mc->deprecation_reason = "machine is old and unmaintained"; machine_add_audiodev_property(mc); } @@ -1452,6 +1453,7 @@ static void n810_class_init(ObjectClass *oc, void *data) /* Actually two chips of 0x4000000 bytes each */ mc->default_ram_size = 0x08000000; mc->default_ram_id = "omap2.dram"; + mc->deprecation_reason = "machine is old and unmaintained"; machine_add_audiodev_property(mc); } diff --git a/hw/arm/palm.c b/hw/arm/palm.c index 8c4c8316140..e04ac92eb7f 100644 --- a/hw/arm/palm.c +++ b/hw/arm/palm.c @@ -309,6 +309,7 @@ static void palmte_machine_init(MachineClass *mc) mc->default_cpu_type = ARM_CPU_TYPE_NAME("ti925t"); mc->default_ram_size = 0x02000000; mc->default_ram_id = "omap1.dram"; + mc->deprecation_reason = "machine is old and unmaintained"; machine_add_audiodev_property(mc); } diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index 643a02b1807..62cd55ba914 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -1041,6 +1041,7 @@ static void spitz_common_class_init(ObjectClass *oc, void *data) mc->block_default_type = IF_IDE; mc->ignore_memory_transaction_failures = true; mc->init = spitz_common_init; + mc->deprecation_reason = "machine is old and unmaintained"; machine_add_audiodev_property(mc); } diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c index 3ca2e4459ca..5891f6064f9 100644 --- a/hw/arm/tosa.c +++ b/hw/arm/tosa.c @@ -270,6 +270,7 @@ static void tosapda_machine_init(MachineClass *mc) mc->init = tosa_init; mc->block_default_type = IF_IDE; mc->ignore_memory_transaction_failures = true; + mc->deprecation_reason = "machine is old and unmaintained"; } DEFINE_MACHINE("tosa", tosapda_machine_init) diff --git a/hw/arm/z2.c b/hw/arm/z2.c index eb2ff8dbc84..fc5672e7ab2 100644 --- a/hw/arm/z2.c +++ b/hw/arm/z2.c @@ -347,6 +347,7 @@ static void z2_machine_init(MachineClass *mc) mc->init = z2_init; mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("pxa270-c5"); + mc->deprecation_reason = "machine is old and unmaintained"; machine_add_audiodev_property(mc); } From patchwork Mon Mar 11 19:12:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779430 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1690165wrt; Mon, 11 Mar 2024 12:21:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWxOcwShOclimczkkQvHjn87Ucv8VGEuX54J4Nq1LCJVPhH9BZgSraStaHQdqB5EvnggTfk0zpb0DG5Otn6vkOs X-Google-Smtp-Source: AGHT+IEgG8hmdXiVy/mSNlvff9xw+jBBb4kLBfAcA5wKwwufCTNY/dZSOadxcfeQ5AAUBLKunFlx X-Received: by 2002:a25:6b08:0:b0:dcb:f7a0:b031 with SMTP id g8-20020a256b08000000b00dcbf7a0b031mr3463549ybc.50.1710184917243; Mon, 11 Mar 2024 12:21:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184917; cv=none; d=google.com; s=arc-20160816; b=MFzTWE5QVWuDxiBiXujMhktWgKKsd8hkBvtY81aCwkevoK6SMWT8xVqf4S+AQU79tF r3KS8L5tMs7fvGaw5/rBXs3iABqtLcQ2yC5VMrW3KaAZEWZvPRioIZkHp6fJk7s+bGj5 ayvPwd12zz9eJIKcjAORAqb6m//QT0Igq5h9JGJwesGuqxgrOTEeEPVRsphNXAK1KcM1 ToV79xVXIewN7zQVIMNFmPFfJtrQQ2OoXb8naA81oTUj55F58BIY+4FCep2unV868jba hq553V7VAOJNWvgkwJyQy8IAZ9QaD56h61A5mHCpK9v/MBLX1u1bej8fTSgYhbO0J+Om +HkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Ae2H6jSaJUto5uaWCnZ0XvoB+nPYp9rIkOUV6PcAjZE=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=XPNMR862cnnD8onco7c/eo36wW6hH7W4c3EbeQuJ7E9pfmRMSegt3CmcHtyLeXdSMZ hvpKa6IvRJF8p0iVWCjUkAWQZIpg1Yh+IULwDiyldcqE0fpKBERldc0C+fodhQfGvSmd 4YEJbjhkkGj0DodFUpkI9DbVJ5D/ukPeYqlt0QkB4KQGkmCtaXmm2I1GorgeIm6iRkr6 b1hgklsbxb7l3fjIwFgYcCtmwQKoN3B4jvsnCaei6vwkhU6Z8iwA/tu9fSAL38b08vsw FjicHQUbn2Z57peNeUsOKO2VSdrC990pCcvxZGYUlpfXi2SQePH9+YD74osL+gBmAYbs /jug==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jkfaibju; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u38-20020a05622a19a600b0042ed109d771si6037140qtc.308.2024.03.11.12.21.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:21:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jkfaibju; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl9a-0006q4-8T; Mon, 11 Mar 2024 15:17:42 -0400 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 1rjl4s-0003M7-Cp for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:54 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4n-0000Ll-Fz for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:49 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-41312232c7aso24405245e9.0 for ; Mon, 11 Mar 2024 12:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184363; x=1710789163; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Ae2H6jSaJUto5uaWCnZ0XvoB+nPYp9rIkOUV6PcAjZE=; b=JkfaibjuQQdKz1fUeyp2hf5iVEAlqHwqmXHveISP6lIhe6OvEeR4BJjD0imXC0o2NQ 2RqP8sHDWn2849NgQafGsvHpC+tCiSEgs+6bMXZhRRfJx3ERYBhfbekdAvL2QoVuJE8j RlRvHkgnLzEFxtlAeNdVPUJVR6sH8Iw8vUZRsovuj5meiEGCEgNNcfV7oznENjczhg03 g2XimtRuilids+36GVOYDjwM2qU6aV4mZwW9G62UQnkdS3ZgYczyt4GtPTtgRbzNY+PM sF3ln4Z6G6MujGiUtobtyrpk3sZlUDZhR8PQ1U/z/apwBBINHW+r9wMAPpxefBfqDib0 kuIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184363; x=1710789163; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ae2H6jSaJUto5uaWCnZ0XvoB+nPYp9rIkOUV6PcAjZE=; b=lqxmY8i4IoaaHlvtzKcGrsId0v2I47piZA3JewekfQwYb4RGbzTmobPavo0QjyzlEx NaUvm3n5iDC1Ef5F4/FVw3ziPpSCUQ/9Cd27+O1QUQKFQWVlFpdrDILHYh7U9qadtRPB qk6woC/3wMWfeAln5aDHIY8adATcLZVmQly48kqpfWnbSlObhDBjG3udORQwqXIJ4NAZ RUb5Mf2i1Iowhl7AtCLCXVtaj3MOgsy+TUNVn1tK6rtGLn7+UCUihYeUkqAPCIkqlRqG ViNSsqtekHxRYCJZ1x5MR03xie5rDkga42WD+d4rxu4+2OBEuYJGUeSEbE6gsQZljG5R 6oig== X-Gm-Message-State: AOJu0YwyubbcmR/bRlEnuwoFgEMKvEy1qbwMpY2zAAVhS7J8zt7GG9b2 SnU+RVrAMl2ATRMMKu5Ua6qGQogZuS35vopoVPvEvTl7GU+R9OqU05jyhBrhPzWn8+Sm4de7fYV X X-Received: by 2002:a05:600c:3b8f:b0:412:969a:24c with SMTP id n15-20020a05600c3b8f00b00412969a024cmr6304403wms.13.1710184363381; Mon, 11 Mar 2024 12:12:43 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:43 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/20] contrib/elf2dmp: Remove unnecessary err flags Date: Mon, 11 Mar 2024 19:12:23 +0000 Message-Id: <20240311191241.4177990-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki They are always evaluated to 1. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Tested-by: Viktor Prutyanov Message-id: 20240307-elf2dmp-v4-1-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/pdb.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c index 40991f5f4c3..abf17c2e7c1 100644 --- a/contrib/elf2dmp/pdb.c +++ b/contrib/elf2dmp/pdb.c @@ -177,7 +177,6 @@ static int pdb_init_segments(struct pdb_reader *r) static int pdb_init_symbols(struct pdb_reader *r) { - int err = 0; PDB_SYMBOLS *symbols; symbols = pdb_ds_read_file(r, 3); @@ -196,7 +195,6 @@ static int pdb_init_symbols(struct pdb_reader *r) /* Read global symbol table */ r->modimage = pdb_ds_read_file(r, symbols->gsym_file); if (!r->modimage) { - err = 1; goto out_symbols; } @@ -205,7 +203,7 @@ static int pdb_init_symbols(struct pdb_reader *r) out_symbols: g_free(symbols); - return err; + return 1; } static int pdb_reader_ds_init(struct pdb_reader *r, PDB_DS_HEADER *hdr) @@ -228,7 +226,6 @@ static int pdb_reader_ds_init(struct pdb_reader *r, PDB_DS_HEADER *hdr) static int pdb_reader_init(struct pdb_reader *r, void *data) { - int err = 0; const char pdb7[] = "Microsoft C/C++ MSF 7.00"; if (memcmp(data, pdb7, sizeof(pdb7) - 1)) { @@ -241,17 +238,14 @@ static int pdb_reader_init(struct pdb_reader *r, void *data) r->ds.root = pdb_ds_read_file(r, 1); if (!r->ds.root) { - err = 1; goto out_ds; } if (pdb_init_symbols(r)) { - err = 1; goto out_root; } if (pdb_init_segments(r)) { - err = 1; goto out_sym; } @@ -264,7 +258,7 @@ out_root: out_ds: pdb_reader_ds_exit(r); - return err; + return 1; } static void pdb_reader_exit(struct pdb_reader *r) @@ -278,7 +272,6 @@ static void pdb_reader_exit(struct pdb_reader *r) int pdb_init_from_file(const char *name, struct pdb_reader *reader) { GError *gerr = NULL; - int err = 0; void *map; reader->gmf = g_mapped_file_new(name, TRUE, &gerr); @@ -291,7 +284,6 @@ int pdb_init_from_file(const char *name, struct pdb_reader *reader) reader->file_size = g_mapped_file_get_length(reader->gmf); map = g_mapped_file_get_contents(reader->gmf); if (pdb_reader_init(reader, map)) { - err = 1; goto out_unmap; } @@ -300,7 +292,7 @@ int pdb_init_from_file(const char *name, struct pdb_reader *reader) out_unmap: g_mapped_file_unref(reader->gmf); - return err; + return 1; } void pdb_exit(struct pdb_reader *reader) From patchwork Mon Mar 11 19:12:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779420 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1686898wrt; Mon, 11 Mar 2024 12:13:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWef9krE9I9Oeku6h30EazKDK3vWs9n4TCVublS9ibtiVVWE7OL8Sr76/TXx3tGvz/ZjHu5uG6X19rNbDoUP2UV X-Google-Smtp-Source: AGHT+IF9envZJ+ct+udiJr8ba+8dAu8K73FyM93Qei9FM6i1yxLQPFiYQqDtEWPiA+NII/+4uJM+ X-Received: by 2002:a05:620a:40c9:b0:788:799f:d8bc with SMTP id g9-20020a05620a40c900b00788799fd8bcmr162811qko.0.1710184415375; Mon, 11 Mar 2024 12:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184415; cv=none; d=google.com; s=arc-20160816; b=LsxgN19kyuPfraRZrpyOjQC9ClT0qua9K6foCEgc46MhC+zUINrEDlcvYaPk6ngX80 PasFT18W5ntncX3XkN+cjlSfvVkJwGgqGweM+1p0kbrr6zaefDiVfOUB+d6DEF3X3M8j p4MgQD/71hQ/Io/ymJqpqPehq0EEKAbiGUb4wwA6rTE36bbqnVjGs4DAJO+BKj1ib2i0 lGRNKGmphqCuvdoJQzP9oLQNsjd8QZua/ub2O7Tvn7gjQqz2npEGmIHekdkunf5XKfEW vKLYRDfrSUMYpaH8u2pqg71Iv2jVjkCxdJVG/H9xrYHpDKfSDeesIj1xGxAhM0IbMzw/ Wr/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cG+mNjXKngqOkSeG7u+wCX4BlFv1Veow5VunaRM/YT4=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=l57FI5B91RRyWo0fhbJQA+eYJ1ovPg8+s1mrLV7ICMn/2jeusAhRuZUudFb1MBKHde sSCHJCKow5M3gcKYwENpWj3aY2RMaZ2ERchSUEH1Oeri42J6mYxXolRt6glJW+8iKXXE 5VPWiEDmvdsvMnfez/401mY+kfRohX75g+4NFfKBO6F6UR2fTxg8RXejqp2/qD0R7Jjr nQIXjVqDtOVKx7vPOpeiV88RxOePuLTk6ECoVdxmh+m6U7icAo3oMNHmnXxd/7QmHd2E JXi7tT9CksYU9aQhsnkH2HQxBNOHb6OefCmeIZ/nJ3My9joP1AWH8JHFaCtbeXVC0w5y UoaA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mGTiREYi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id wg25-20020a05620a569900b00787330d0232si5736343qkn.485.2024.03.11.12.13.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:13:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mGTiREYi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl5K-0003TP-Fw; Mon, 11 Mar 2024 15:13:20 -0400 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 1rjl4q-0003IZ-Oe for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:51 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4n-0000Lx-MC for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:48 -0400 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-513af1a29b1so1089744e87.1 for ; Mon, 11 Mar 2024 12:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184364; x=1710789164; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=cG+mNjXKngqOkSeG7u+wCX4BlFv1Veow5VunaRM/YT4=; b=mGTiREYibluVYg94H8xMB3Z2/9Wwic4qVJYHSoZ4IT2XGSLO3euNHmBrZAASwgq8DF b70MayJBvB/IZGnTTsNd8d88X/ae5eO4J6Nol9fDie43TaRzdc+189N7QYRDfsLS9fCK VpDP07ANiOHtKtqPxPdigocJD9Wdkp4PuQ/I5CToNaLkvc8r2qv/sQZq5ZUp0+1wytN4 HBz1s/yxcnv7OZwBc0tTBQg/jSZVFVXjhdkHxkBJNZ9SfVV9gS/6vWpnW+QlIdWCjeSS fGj4lJ/kU/ouvFxD8+2N992AzSqSjr1cEHiV+YF6GN6k8Sbm9+7Vp4trEcEieTHQLrSc 8xZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184364; x=1710789164; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cG+mNjXKngqOkSeG7u+wCX4BlFv1Veow5VunaRM/YT4=; b=BRoZjsTuqf3C1+4RHBriLPpqQz8mm2UnJaSgkvycw+YcbeRirkveuTXE3CIb4dMSHf BZWvw3c8xv5oebdIWHdfeqNrdY+179BYkPtTKRIXbjXWdG/znLRLBiIGjeJmhO2zgOqy r7C109gbp4TViX8Mfsw8JYBslhj9yeT1XBHxy4iYYmsP0Tp5ae5DsOrMQXH0/6wl5y/f nzVKuXMckm2EDV73jNQR9a3xGr0t6QxTRxvegqRKUgyQD5aBX6ElplFazfo2dEHvUmta aG2Yxwq3ia+q4Q/P7xfjF0nWn7x1Zc/etJGIxxbyPSND+VonBR62obGaG2ooSXnZI051 sBMw== X-Gm-Message-State: AOJu0Yxttk/jMBv1/3dh52Leg4EFKgEalJTI7O3qzI/0zHh5Eg3rKWAs J4KA9pZIfP3/tF1Y1ToIz+UaGzgtgbOUxz7ATt3uuHjUZt6sUTAqK8WKqM8vae+EvqBETBJTaWs S X-Received: by 2002:a19:3807:0:b0:513:8f53:cab0 with SMTP id f7-20020a193807000000b005138f53cab0mr5061837lfa.27.1710184363768; Mon, 11 Mar 2024 12:12:43 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:43 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/20] contrib/elf2dmp: Assume error by default Date: Mon, 11 Mar 2024 19:12:24 +0000 Message-Id: <20240311191241.4177990-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x131.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki A common construct in contrib/elf2dmp is to set "err" flag and goto in error paths. In such a construct, there is only one successful path while there are several error paths, so it will be more simpler to initialize "err" flag set, and clear it in the successful path. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Tested-by: Viktor Prutyanov Message-id: 20240307-elf2dmp-v4-2-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/download.c | 4 +--- contrib/elf2dmp/main.c | 15 +++------------ 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/contrib/elf2dmp/download.c b/contrib/elf2dmp/download.c index bd7650a7a27..902dc04ffa5 100644 --- a/contrib/elf2dmp/download.c +++ b/contrib/elf2dmp/download.c @@ -11,7 +11,7 @@ int download_url(const char *name, const char *url) { - int err = 0; + int err = 1; FILE *file; CURL *curl = curl_easy_init(); @@ -21,7 +21,6 @@ int download_url(const char *name, const char *url) file = fopen(name, "wb"); if (!file) { - err = 1; goto out_curl; } @@ -33,7 +32,6 @@ int download_url(const char *name, const char *url) || curl_easy_perform(curl) != CURLE_OK) { unlink(name); fclose(file); - err = 1; } else { err = fclose(file); } diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index cbc38a7c103..9b278f392e3 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -511,7 +511,7 @@ static void pe_get_pdb_symstore_hash(OMFSignatureRSDS *rsds, char *hash) int main(int argc, char *argv[]) { - int err = 0; + int err = 1; QEMU_Elf qemu_elf; struct pa_space ps; struct va_space vs; @@ -542,7 +542,6 @@ int main(int argc, char *argv[]) if (pa_space_create(&ps, &qemu_elf)) { eprintf("Failed to initialize physical address space\n"); - err = 1; goto out_elf; } @@ -552,7 +551,6 @@ int main(int argc, char *argv[]) va_space_create(&vs, &ps, state->cr[3]); if (fix_dtb(&vs, &qemu_elf)) { eprintf("Failed to find paging base\n"); - err = 1; goto out_elf; } @@ -561,7 +559,6 @@ int main(int argc, char *argv[]) if (va_space_rw(&vs, state->idt.base, &first_idt_desc, sizeof(first_idt_desc), 0)) { eprintf("Failed to get CPU #0 IDT[0]\n"); - err = 1; goto out_ps; } printf("CPU #0 IDT[0] -> 0x%016"PRIx64"\n", idt_desc_addr(first_idt_desc)); @@ -586,7 +583,6 @@ int main(int argc, char *argv[]) if (!kernel_found) { eprintf("Failed to find NT kernel image\n"); - err = 1; goto out_ps; } @@ -600,45 +596,40 @@ int main(int argc, char *argv[]) if (download_url(PDB_NAME, pdb_url)) { eprintf("Failed to download PDB file\n"); - err = 1; goto out_ps; } if (pdb_init_from_file(PDB_NAME, &pdb)) { eprintf("Failed to initialize PDB reader\n"); - err = 1; goto out_pdb_file; } if (!SYM_RESOLVE(KernBase, &pdb, KdDebuggerDataBlock) || !SYM_RESOLVE(KernBase, &pdb, KdVersionBlock)) { - err = 1; goto out_pdb; } kdbg = get_kdbg(KernBase, &pdb, &vs, KdDebuggerDataBlock); if (!kdbg) { - err = 1; goto out_pdb; } if (fill_header(&header, &ps, &vs, KdDebuggerDataBlock, kdbg, KdVersionBlock, qemu_elf.state_nr)) { - err = 1; goto out_kdbg; } if (fill_context(kdbg, &vs, &qemu_elf)) { - err = 1; goto out_kdbg; } if (write_dump(&ps, &header, argv[2])) { eprintf("Failed to save dump\n"); - err = 1; goto out_kdbg; } + err = 0; + out_kdbg: g_free(kdbg); out_pdb: From patchwork Mon Mar 11 19:12:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779426 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1689656wrt; Mon, 11 Mar 2024 12:20:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX9hmtCRgsGVfRRmSJdBA07oLvwi+8RtYbnEw82tpvDG4S1qUKzqDfGmBqaENAiQ+62blM+H+6LaoReVuQE1mRH X-Google-Smtp-Source: AGHT+IHKDWeUMSarzFF3PtZasZBiq8+ZSEfmqYQpjTyMe+kCVzfv2O55XQxYET5h/ChardupaXSp X-Received: by 2002:a05:6359:4597:b0:17b:59e6:ff8c with SMTP id no23-20020a056359459700b0017b59e6ff8cmr10993156rwb.6.1710184836132; Mon, 11 Mar 2024 12:20:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184836; cv=none; d=google.com; s=arc-20160816; b=p6TTC2Nk3hwtFxRZYP2DuAHW/rL8YOMvugdmmC1dCiWz1Lel521a/hFh4ppxMv9kHq Z3uLwe3lPdPn1+6F8h82szr8VipzNB+A7t55NTog3sf2FHA7KXa161Pcubo4tcnDXy99 hMwQlkol3cLNfxX9vMXO13vcnPnjMw0032X3TBLvh6Ir4ausnUnsqFRZvEM+zdJp+zg3 l0XBP6l7d/xrCKg1bu4fz7fINxVTk8xrLqbRbe22A0a8nheaM6fnxGfS8zLpTLPAhgoS WhBEA2nvNd7oQuXYwzY4K6koknBq/SRyJBJFhmjpAWb3NZKZow7WZKV2cf5XJZCAo1tD AE/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=zc+ckQmpBvqBoIUO6cJJ2qIcD3yUGjjQZyKjrxix+5k=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=BEJWvtd/AsZDsCxqaYRGw+pqLZktO6plbWFtGdAPRhamyct7meA8Lmebn9lSNzQUBF UxqZ+2Jf+NfHCJdxzFJs1vtidtkn23/eNI8sloGQULpntcbsID0erQx1lAinvy0Vii6o vHsxkGO8mkmtqZkfFURBqHGvqhfLTgtpwUPg+j4aY29fGFJ7dr0nSLwiQZmx/AmcjLuf 8vMqHbnuc+0Ke6XW8fzl33vqyDSD5QtO27+Iaw7H+vCJbUm9/hceTiv+MQl3Ad7+vC8u Y3XzXVW2CPuCToSTL9r8odjI7q8pIlhy7Gtk6BT/01yI3/Z6Yfg9CYEFEMQN45saqkKZ Bqtw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p8059nxJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bs39-20020a05620a472700b007877ab19a77si6471957qkb.147.2024.03.11.12.20.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:20:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p8059nxJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl9S-0006es-Js; Mon, 11 Mar 2024 15:17:36 -0400 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 1rjl4r-0003Js-D5 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:53 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4p-0000M4-CC for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:49 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-41332865b05so379135e9.0 for ; Mon, 11 Mar 2024 12:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184365; x=1710789165; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=zc+ckQmpBvqBoIUO6cJJ2qIcD3yUGjjQZyKjrxix+5k=; b=p8059nxJ/VmA2lq1S2u6oaqz3fQHYPU8WQxweqyMc2Vf96A1t4WqTUeUTLJr9OkSp2 YQ0YySl8tOJOk7Xq0jVxIaw8Q8FqN8KW7HliCxV5iIgZilVTG2qjVcu0OjFlYrQpx1Rt 8JqlzqvsSk4KWX+edQfxS0w2J6sRRVXws+ig893alqvin2BLQcGyZZReGDTBzlt3yFI4 hzTz2YZ90sLXsAt+LnNexZhuiRR7FsTHkzvzz4UCvVO8TBKP5KiHM55mAeAFmJXo4/ST Bo8/OY9xrdAYprR3lbr5a3N95TGFRO2fQVBZZJdV6OfeAoX3WAmsYNNI6oXdnY4Saxjv CpGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184365; x=1710789165; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zc+ckQmpBvqBoIUO6cJJ2qIcD3yUGjjQZyKjrxix+5k=; b=dwX9xjsf1Rsxnx70/Jl9Z7KO0IfxNrMaSHpNrTCT3flsQ5fuzOMecg/DVrnV/f6jqw dH7yMelKL+QtI2NTvpDNR00e7cSO+hYlz4oouoeJdKT5uWIN2FgHnPccANpT0CekrCZp 1F1oiAmS1A2EJbE9ReXaKM6yqk367aEQSsJ4gIj7WsKQB3UZ5wZSLc8bK1Lz/vMtPqYL 6wM3oYsgKl6ayZOh2t4TnzELjR34p8cZGI6ruju+kzDSQsuZg4A1lUoXRYQvUyc88OH0 tW9TWe2iGd7sf03CSqjsF1TvXotp5drBsRzc6g0edwGGh6CHuxxx5dymRQrvW8X3kvys 6plA== X-Gm-Message-State: AOJu0YyOgqG67tSljY4OfzVboHQ9PoVsfBBeWSq9iiokK3QyAfyd10Z5 j+pHCP9R/yo885GLhrYmL/bIidmQY8cZJaeXz3SqdcMJlfZeaWV3yVKqcZqDuJMknz/9wthMHef d X-Received: by 2002:a05:600c:4e4e:b0:413:15fc:231 with SMTP id e14-20020a05600c4e4e00b0041315fc0231mr5142454wmq.29.1710184364730; Mon, 11 Mar 2024 12:12:44 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:44 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/20] contrib/elf2dmp: Continue even contexts are lacking Date: Mon, 11 Mar 2024 19:12:25 +0000 Message-Id: <20240311191241.4177990-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki Let fill_context() continue even if it fails to fill contexts of some CPUs. A dump may still contain valuable information even if it lacks contexts of some CPUs due to dump corruption or a failure before starting CPUs. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Tested-by: Viktor Prutyanov Message-id: 20240307-elf2dmp-v4-3-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/main.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index 9b278f392e3..86e709e6da3 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -336,8 +336,13 @@ static int fill_header(WinDumpHeader64 *hdr, struct pa_space *ps, return 0; } -static int fill_context(KDDEBUGGER_DATA64 *kdbg, - struct va_space *vs, QEMU_Elf *qe) +/* + * fill_context() continues even if it fails to fill contexts of some CPUs. + * A dump may still contain valuable information even if it lacks contexts of + * some CPUs due to dump corruption or a failure before starting CPUs. + */ +static void fill_context(KDDEBUGGER_DATA64 *kdbg, + struct va_space *vs, QEMU_Elf *qe) { int i; @@ -350,7 +355,7 @@ static int fill_context(KDDEBUGGER_DATA64 *kdbg, if (va_space_rw(vs, kdbg->KiProcessorBlock + sizeof(Prcb) * i, &Prcb, sizeof(Prcb), 0)) { eprintf("Failed to read CPU #%d PRCB location\n", i); - return 1; + continue; } if (!Prcb) { @@ -361,7 +366,7 @@ static int fill_context(KDDEBUGGER_DATA64 *kdbg, if (va_space_rw(vs, Prcb + kdbg->OffsetPrcbContext, &Context, sizeof(Context), 0)) { eprintf("Failed to read CPU #%d ContextFrame location\n", i); - return 1; + continue; } printf("Filling context for CPU #%d...\n", i); @@ -369,11 +374,9 @@ static int fill_context(KDDEBUGGER_DATA64 *kdbg, if (va_space_rw(vs, Context, &ctx, sizeof(ctx), 1)) { eprintf("Failed to fill CPU #%d context\n", i); - return 1; + continue; } } - - return 0; } static int pe_get_data_dir_entry(uint64_t base, void *start_addr, int idx, @@ -619,9 +622,7 @@ int main(int argc, char *argv[]) goto out_kdbg; } - if (fill_context(kdbg, &vs, &qemu_elf)) { - goto out_kdbg; - } + fill_context(kdbg, &vs, &qemu_elf); if (write_dump(&ps, &header, argv[2])) { eprintf("Failed to save dump\n"); From patchwork Mon Mar 11 19:12:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779435 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1690361wrt; Mon, 11 Mar 2024 12:22:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXyKnpcohkMZnhh0alf6uzOqewTbvMDh1F4xk4nOn4p7mD7xaoXQgDlMaDiY4iVC3+5f0/pFgLa4BHzUsnUBaJ8 X-Google-Smtp-Source: AGHT+IGQ2MFug4mhLSh/e2BgSpTVJCNtRqxtiKlci2gTdkA/yQweVOTbazS+78eba0zccYvDMTEK X-Received: by 2002:a81:f207:0:b0:60a:170e:574a with SMTP id i7-20020a81f207000000b0060a170e574amr6011411ywm.43.1710184946190; Mon, 11 Mar 2024 12:22:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184946; cv=none; d=google.com; s=arc-20160816; b=s8SrA/qw90nGatThQ/dlvoV2mKDWO/tJP0PnwdPQAddryHQJSvy3jV22BfwrXXgO/Q hfWYNjSkvSna9atF3MybC2CrP6OEZWY58MMKeyEcW+eL+ZLD86937uvqfE4uvUdeZbof DTcWAmzEMJa85P+amxu2rDRGjVau7VwYwigPFENQmRcLmlOm4xEb6t0oqIBTU+uWtDvB JQQYAieOv5FCkdi1wKBEdRJ5yh04MVbXTuELBHUhluckCSbjzH/f9n35KUpuS3VRSlrL G4kISgPcDsOx3bMlT6KoWxjXCHCmrQGM4TMyRXKYKTq/9jeGZeetkLp2u6iAcrBNUzqo jrow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=uGkqi61JFcx0yploTSJU0yOV4s33JLq/DllCnbokV38=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Hv51Dsurac86usQnCmgVn6a3du4amXMguw+Up54gS0m8LSH/k7sBkFgAceZ5iqKB9W 7Jz56iB2AkWommrJb5JUzPnfLnhVzCEw5i8vCUBbxe5MOgD84z81RBBMCP+uk1SN+qVx NQIGVbIdBugiQ9fTv4DP72beP8gqfDIoqqrMWVJMkYIevdjW9qTvELVpIoe+z1NUdLwF f04EByhdxraSpORzr7+xEEGWtg1wIpyuRiOPCYadNYFtjKd5FLYyYQgZmqPGfF/Kfh4p c6isqR/Y1yJ/UX9ODZqwloieDkQ/OkMGigEwRZvl96UqWLuZnIb02zLQOxNGzzwLb23y wN+w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nPi0jeCD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c9-20020ac85a89000000b0042f2009c9e4si6116827qtc.762.2024.03.11.12.22.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:22:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nPi0jeCD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl9K-0006aJ-Ku; Mon, 11 Mar 2024 15:17:29 -0400 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 1rjl4u-0003OD-4h for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:59 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4r-0000M8-4D for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:51 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4132600824bso9416725e9.2 for ; Mon, 11 Mar 2024 12:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184365; x=1710789165; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=uGkqi61JFcx0yploTSJU0yOV4s33JLq/DllCnbokV38=; b=nPi0jeCD+2iLMXV2964VV52M9+/H6ck+LZ/sDDOqy+yvLnhV5a2pw318A2cdszWJ6E 5QcrIcKTm2Grq/pItCQLdiVlEVODU7i19kugEiX5DrEt6+U80lLNG7grFMUl8KhGagqt 46dWu8rhssjH4+Zuo8MDtNkz0k1scIvCM6ovbP3v71hh/dFzHx5nPYFLSp33coXqxwuw gwFRaUun6sMq4jYKQSKhyeE3TZBiAowEWBSY3YaafbMLvxmmijzTuBbm7m+g9gBGiyoo BYYqMo1YvFnqwz3utm1Spd/yF0BIS4/rTGwUBvBOJgxdJDYZZoblkSFaiBOw3oSUn16/ e37g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184365; x=1710789165; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uGkqi61JFcx0yploTSJU0yOV4s33JLq/DllCnbokV38=; b=pBnMf0RUfzFLo4I+KU/AjdvajFdCrJ6pPUcksznB7jrUNHJVi/MFQrlZ984GK4a1Wj BqwHm63377yBemT3XsaQmsuqziOsWZlZeZgolN31dLyQBO6UzzEQa2uFGQsC32tgBK9q PiFnNyXZfVt+peIU0yvWTFVyLCLharxFOIHLe2aBCP23eKmxNck/t8ys7osTIxEFe4Ep MuCvRAL2O9M0kRKZCVkewCReqGFHk2yQJ09JMozR5Lwy0yo2u3p986S4CdRvKPTZVba9 UCA/eeiV/A6Kz+u3KVFkfa6o02nHvjNvJh0M723Q8x+YCbigREdXMGg2huYHdD0ZbN0M 2JkQ== X-Gm-Message-State: AOJu0YzHdqPpuNcVTGzAkBwDMn7suAvRzhlBMTJCkyEvnwhFmCo2OHHD ZVnNPSC2OhSkj/YqtBQEn3MC3ZRQ0kXiq/qGd2rQSEWL73xKluWZ9MimYX5nuhzC7lkTqrb+UGS Q X-Received: by 2002:a05:600c:3b07:b0:413:27d0:45f4 with SMTP id m7-20020a05600c3b0700b0041327d045f4mr1039924wms.6.1710184365205; Mon, 11 Mar 2024 12:12:45 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:44 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/20] contrib/elf2dmp: Change pa_space_create() signature Date: Mon, 11 Mar 2024 19:12:26 +0000 Message-Id: <20240311191241.4177990-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki pa_space_create() used to return an integer to propagate error, but it never fails so let it return void. Signed-off-by: Akihiko Odaki Tested-by: Viktor Prutyanov Reviewed-by: Philippe Mathieu-Daudé Message-id: 20240307-elf2dmp-v4-4-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/addrspace.h | 2 +- contrib/elf2dmp/addrspace.c | 4 +--- contrib/elf2dmp/main.c | 5 +---- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/contrib/elf2dmp/addrspace.h b/contrib/elf2dmp/addrspace.h index 039c70c5b07..c868d647387 100644 --- a/contrib/elf2dmp/addrspace.h +++ b/contrib/elf2dmp/addrspace.h @@ -33,7 +33,7 @@ struct va_space { struct pa_space *ps; }; -int pa_space_create(struct pa_space *ps, QEMU_Elf *qemu_elf); +void pa_space_create(struct pa_space *ps, QEMU_Elf *qemu_elf); void pa_space_destroy(struct pa_space *ps); void va_space_create(struct va_space *vs, struct pa_space *ps, uint64_t dtb); diff --git a/contrib/elf2dmp/addrspace.c b/contrib/elf2dmp/addrspace.c index 6f608a517b1..4c127c9b1ec 100644 --- a/contrib/elf2dmp/addrspace.c +++ b/contrib/elf2dmp/addrspace.c @@ -57,7 +57,7 @@ static void pa_block_align(struct pa_block *b) b->paddr += low_align; } -int pa_space_create(struct pa_space *ps, QEMU_Elf *qemu_elf) +void pa_space_create(struct pa_space *ps, QEMU_Elf *qemu_elf) { Elf64_Half phdr_nr = elf_getphdrnum(qemu_elf->map); Elf64_Phdr *phdr = elf64_getphdr(qemu_elf->map); @@ -87,8 +87,6 @@ int pa_space_create(struct pa_space *ps, QEMU_Elf *qemu_elf) } ps->block_nr = block_i; - - return 0; } void pa_space_destroy(struct pa_space *ps) diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index 86e709e6da3..8a71e2efd28 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -543,10 +543,7 @@ int main(int argc, char *argv[]) return 1; } - if (pa_space_create(&ps, &qemu_elf)) { - eprintf("Failed to initialize physical address space\n"); - goto out_elf; - } + pa_space_create(&ps, &qemu_elf); state = qemu_elf.state[0]; printf("CPU #0 CR3 is 0x%016"PRIx64"\n", state->cr[3]); From patchwork Mon Mar 11 19:12:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779433 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1690242wrt; Mon, 11 Mar 2024 12:22:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWcYw2mlhqdRS0YI/8n37z4zp4Dv0oVQ8vl5cFOI6xP0A/8Hwr65EFRL1ga7msDphj0mEcZM4VXrlaT0d//NHBe X-Google-Smtp-Source: AGHT+IGvPn/ExkGMOc1uJkj0zWrLfzcjpTXY4EuAI7/3gvbKQkWSWstf76sZXZUKKB3ylfuS1Ad1 X-Received: by 2002:a05:622a:50e:b0:42e:e3b4:c620 with SMTP id l14-20020a05622a050e00b0042ee3b4c620mr10634928qtx.55.1710184928943; Mon, 11 Mar 2024 12:22:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184928; cv=none; d=google.com; s=arc-20160816; b=C6NoFyPeNcJuS4TIyT3KgU5AAEmgHIETGIx8JySFoFzA0pPd0vgI1DX9D7R0g4NDjY uZjxkZ5zfwTJiPpOeFYFkL7MY0AB8VhGEwnF9sFwi3D1R2zmUjTQlyrVSUBPpsmDjyUZ NKOT0QeVnE5/1N3/Dj9C3iv3Zss1XpOAnm0qFp0SkIkrVE43pZ+BVer+EMGgl+26d4Te WgimA6MDZ0FdXSAj5+LUg+45umEat/iV4s56pEwKOAy6WbR+OAY5SOPt2RbYUxkgPsF1 xHRY6zG5aJzXv9gjgMs+mRwUC31bnOpB7Solm7loAZv/imX5GOBQJWVzXAL82m/fBfW+ d4MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=1vz5/CWs4cBAwnzrh8kwb3AZ0Dz8ocBGmwZVUospu4A=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=QdvsqcWELLPlP4+pvtm7nw/FRhBZcgV0NnAzBEeY9VeS0cBrO6Puc14A7gnrMpcSKw lCxDHbtNJT2BeDAE02rLC2NoYYl+1Gha0+H1C6qxe5sxbmIhgSO1qsT+zkeoparBuqrL VBVefx/uflWj+Lda7KFnL81E7J4UMh0PBQcUHRRDDLrNlqfVHpt0DPa+csCBDjcpEZxV LNEXmHbh3ix7+FvqswejrZqoOgy+gnj3++tRgTMrsrrFMktzXRIeLgfBZit9CenAJGkg UOWYkk9WohswBp3nD/JApRTjwJjATXXeY5YkAMzIOyjGPRH0D1A9YtM9DLl/PcU8u4ps cuKQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y54NYpw9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x10-20020ac85f0a000000b0042ebf6330b9si6155734qta.312.2024.03.11.12.22.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:22:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y54NYpw9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl9o-0006rM-AQ; Mon, 11 Mar 2024 15:17:56 -0400 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 1rjl4s-0003MB-Su for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:54 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4q-0000ME-8f for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:50 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4132ab0c302so8939425e9.3 for ; Mon, 11 Mar 2024 12:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184366; x=1710789166; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=1vz5/CWs4cBAwnzrh8kwb3AZ0Dz8ocBGmwZVUospu4A=; b=Y54NYpw9Nke9tCtV3IhUtSs3rdt289/9M4B7k5uAfuv4bVfIguxM+H+A7m3FV3MmkP P3NlTKsriXbZHgG/cpOUdrPJgyjiC5c6qjK5eRLNV3ZiGPYPhA4j30k8u1aG21E+eJV3 KWyqDqOQ40DmPNbaYUMo2q6NC2qSExijE5i+JECanw8wn80fq63r2gAjvyAAS3j4nUgJ /jfaNVRsSopX3VQhP0btENEBkHJbLL9du2VrbeDM3dY8HshjdcF6DlprBz6NpHqYXPO1 iYNhn9Mwc4Qz/TC7e++zJn/cUq8G3B91k6MldNWkw+v8uMiyWuU02zsXrRVDiu4LEYHr cRpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184366; x=1710789166; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1vz5/CWs4cBAwnzrh8kwb3AZ0Dz8ocBGmwZVUospu4A=; b=ruGZJ1dDUO+K7C+EOh/Abh4ltmQKoW9PR7zGpYwcAUZcbrNLqVMOkWBE7H5ZgKZwkJ 5K2ffCH7HzpctGbnxNjmHsYzS5vgREfgtoiNWGIyuVcoSO/qFjng9fG12NhZFvlnJZ+C r83eO03xXwOCtWxarZp8CDmkWPlckXMtbf1rzbvR9WAn46UkIPQsj9ULj/HjfquCjkRT u4PU6OMAjiG6OmgfmMUijjpdhKEugYrBMKSH75/8MCATXHPpqNDrFErraPx7e2seNXA/ Bhnu6tSrreoUjmdJBjX9EWEtmehsqJSCIJypGq9UdNqkhPwUzJ8RxiHT3GppWqVUTmiz 8BTA== X-Gm-Message-State: AOJu0Yy0jHxfZIRNXI/DHIofIaO1F+dVnT3AxD2N/xKHjjF2cF9NxA2O 4pjQaaKUZA8RwdEFZiX2eRP+k5EQjQlIdQz002VmytrmWbKpCn8Q7SUQ7NVPUalwxju2HqtPwKZ N X-Received: by 2002:a05:600c:3f94:b0:413:2ae8:428d with SMTP id fs20-20020a05600c3f9400b004132ae8428dmr2489251wmb.14.1710184365578; Mon, 11 Mar 2024 12:12:45 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:45 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/20] contrib/elf2dmp: Fix error reporting style in addrspace.c Date: Mon, 11 Mar 2024 19:12:27 +0000 Message-Id: <20240311191241.4177990-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki include/qapi/error.h says: > We recommend > * bool-valued functions return true on success / false on failure, > ... Signed-off-by: Akihiko Odaki Tested-by: Viktor Prutyanov Reviewed-by: Philippe Mathieu-Daudé Message-id: 20240307-elf2dmp-v4-5-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/addrspace.h | 4 ++-- contrib/elf2dmp/addrspace.c | 8 +++---- contrib/elf2dmp/main.c | 47 +++++++++++++++++-------------------- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/contrib/elf2dmp/addrspace.h b/contrib/elf2dmp/addrspace.h index c868d647387..2ad30a9da48 100644 --- a/contrib/elf2dmp/addrspace.h +++ b/contrib/elf2dmp/addrspace.h @@ -39,7 +39,7 @@ void pa_space_destroy(struct pa_space *ps); void va_space_create(struct va_space *vs, struct pa_space *ps, uint64_t dtb); void va_space_set_dtb(struct va_space *vs, uint64_t dtb); void *va_space_resolve(struct va_space *vs, uint64_t va); -int va_space_rw(struct va_space *vs, uint64_t addr, - void *buf, size_t size, int is_write); +bool va_space_rw(struct va_space *vs, uint64_t addr, + void *buf, size_t size, int is_write); #endif /* ADDRSPACE_H */ diff --git a/contrib/elf2dmp/addrspace.c b/contrib/elf2dmp/addrspace.c index 4c127c9b1ec..c995c723ae8 100644 --- a/contrib/elf2dmp/addrspace.c +++ b/contrib/elf2dmp/addrspace.c @@ -226,8 +226,8 @@ void *va_space_resolve(struct va_space *vs, uint64_t va) return pa_space_resolve(vs->ps, pa); } -int va_space_rw(struct va_space *vs, uint64_t addr, - void *buf, size_t size, int is_write) +bool va_space_rw(struct va_space *vs, uint64_t addr, + void *buf, size_t size, int is_write) { while (size) { uint64_t page = addr & ELF2DMP_PFN_MASK; @@ -238,7 +238,7 @@ int va_space_rw(struct va_space *vs, uint64_t addr, ptr = va_space_resolve(vs, addr); if (!ptr) { - return 1; + return false; } if (is_write) { @@ -252,5 +252,5 @@ int va_space_rw(struct va_space *vs, uint64_t addr, addr += s; } - return 0; + return true; } diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index 8a71e2efd28..09af39422f1 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -79,9 +79,9 @@ static KDDEBUGGER_DATA64 *get_kdbg(uint64_t KernBase, struct pdb_reader *pdb, bool decode = false; uint64_t kwn, kwa, KdpDataBlockEncoded; - if (va_space_rw(vs, - KdDebuggerDataBlock + offsetof(KDDEBUGGER_DATA64, Header), - &kdbg_hdr, sizeof(kdbg_hdr), 0)) { + if (!va_space_rw(vs, + KdDebuggerDataBlock + offsetof(KDDEBUGGER_DATA64, Header), + &kdbg_hdr, sizeof(kdbg_hdr), 0)) { eprintf("Failed to extract KDBG header\n"); return NULL; } @@ -97,8 +97,8 @@ static KDDEBUGGER_DATA64 *get_kdbg(uint64_t KernBase, struct pdb_reader *pdb, return NULL; } - if (va_space_rw(vs, KiWaitNever, &kwn, sizeof(kwn), 0) || - va_space_rw(vs, KiWaitAlways, &kwa, sizeof(kwa), 0)) { + if (!va_space_rw(vs, KiWaitNever, &kwn, sizeof(kwn), 0) || + !va_space_rw(vs, KiWaitAlways, &kwa, sizeof(kwa), 0)) { return NULL; } @@ -122,7 +122,7 @@ static KDDEBUGGER_DATA64 *get_kdbg(uint64_t KernBase, struct pdb_reader *pdb, kdbg = g_malloc(kdbg_hdr.Size); - if (va_space_rw(vs, KdDebuggerDataBlock, kdbg, kdbg_hdr.Size, 0)) { + if (!va_space_rw(vs, KdDebuggerDataBlock, kdbg, kdbg_hdr.Size, 0)) { eprintf("Failed to extract entire KDBG\n"); g_free(kdbg); return NULL; @@ -286,7 +286,7 @@ static int fill_header(WinDumpHeader64 *hdr, struct pa_space *ps, return 1; } - if (va_space_rw(vs, KdVersionBlock, &kvb, sizeof(kvb), 0)) { + if (!va_space_rw(vs, KdVersionBlock, &kvb, sizeof(kvb), 0)) { eprintf("Failed to extract KdVersionBlock\n"); return 1; } @@ -352,8 +352,8 @@ static void fill_context(KDDEBUGGER_DATA64 *kdbg, WinContext64 ctx; QEMUCPUState *s = qe->state[i]; - if (va_space_rw(vs, kdbg->KiProcessorBlock + sizeof(Prcb) * i, - &Prcb, sizeof(Prcb), 0)) { + if (!va_space_rw(vs, kdbg->KiProcessorBlock + sizeof(Prcb) * i, + &Prcb, sizeof(Prcb), 0)) { eprintf("Failed to read CPU #%d PRCB location\n", i); continue; } @@ -363,8 +363,8 @@ static void fill_context(KDDEBUGGER_DATA64 *kdbg, continue; } - if (va_space_rw(vs, Prcb + kdbg->OffsetPrcbContext, - &Context, sizeof(Context), 0)) { + if (!va_space_rw(vs, Prcb + kdbg->OffsetPrcbContext, + &Context, sizeof(Context), 0)) { eprintf("Failed to read CPU #%d ContextFrame location\n", i); continue; } @@ -372,7 +372,7 @@ static void fill_context(KDDEBUGGER_DATA64 *kdbg, printf("Filling context for CPU #%d...\n", i); win_context_init_from_qemu_cpu_state(&ctx, s); - if (va_space_rw(vs, Context, &ctx, sizeof(ctx), 1)) { + if (!va_space_rw(vs, Context, &ctx, sizeof(ctx), 1)) { eprintf("Failed to fill CPU #%d context\n", i); continue; } @@ -396,8 +396,8 @@ static int pe_get_data_dir_entry(uint64_t base, void *start_addr, int idx, return 1; } - if (va_space_rw(vs, base + dos_hdr->e_lfanew, - &nt_hdrs, sizeof(nt_hdrs), 0)) { + if (!va_space_rw(vs, base + dos_hdr->e_lfanew, + &nt_hdrs, sizeof(nt_hdrs), 0)) { return 1; } @@ -406,9 +406,7 @@ static int pe_get_data_dir_entry(uint64_t base, void *start_addr, int idx, return 1; } - if (va_space_rw(vs, - base + data_dir[idx].VirtualAddress, - entry, size, 0)) { + if (!va_space_rw(vs, base + data_dir[idx].VirtualAddress, entry, size, 0)) { return 1; } @@ -470,9 +468,8 @@ static bool pe_check_pdb_name(uint64_t base, void *start_addr, return false; } - if (va_space_rw(vs, - base + debug_dir.AddressOfRawData, - rsds, sizeof(*rsds), 0)) { + if (!va_space_rw(vs, base + debug_dir.AddressOfRawData, + rsds, sizeof(*rsds), 0)) { eprintf("Failed to resolve OMFSignatureRSDS\n"); return false; } @@ -488,9 +485,9 @@ static bool pe_check_pdb_name(uint64_t base, void *start_addr, return false; } - if (va_space_rw(vs, base + debug_dir.AddressOfRawData + - offsetof(OMFSignatureRSDS, name), pdb_name, sizeof(PDB_NAME), - 0)) { + if (!va_space_rw(vs, base + debug_dir.AddressOfRawData + + offsetof(OMFSignatureRSDS, name), + pdb_name, sizeof(PDB_NAME), 0)) { eprintf("Failed to resolve PDB name\n"); return false; } @@ -556,8 +553,8 @@ int main(int argc, char *argv[]) printf("CPU #0 IDT is at 0x%016"PRIx64"\n", state->idt.base); - if (va_space_rw(&vs, state->idt.base, - &first_idt_desc, sizeof(first_idt_desc), 0)) { + if (!va_space_rw(&vs, state->idt.base, + &first_idt_desc, sizeof(first_idt_desc), 0)) { eprintf("Failed to get CPU #0 IDT[0]\n"); goto out_ps; } From patchwork Mon Mar 11 19:12:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779432 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1690237wrt; Mon, 11 Mar 2024 12:22:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXsJLK3LuqhRDMrQEViMTPVBo2GV4oORtDkgge9zip2gm2nJY/QkMLT+EkPMmOse6aMegUfGn90/t1FAHD2r1NV X-Google-Smtp-Source: AGHT+IH07gA3bINpXIyF9qkKO+SapKuAfLln/1iCZvzW+pf0f/6hrt0S5pd9Kxj2TinIuwinzdN6 X-Received: by 2002:a67:ed0e:0:b0:473:24cf:f510 with SMTP id l14-20020a67ed0e000000b0047324cff510mr4308974vsp.6.1710184928793; Mon, 11 Mar 2024 12:22:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184928; cv=none; d=google.com; s=arc-20160816; b=r3mscmTHaiTWo7EIk+BcAHBOPz9yWqNypC9aAq5NqLo0WNsnWAGtYXsN7tnEGVogo1 Whz9+Y53nVF6vq8P+8MhcFhO3Lm/k5YhZRt85wDQIaIcGUYho2o6lnYOvKZIAMLnfBFQ vWtlxaFcHsd+ffgNO8ezJDbwadlXKFHxLv1Ri+p9S4/dHCrJOsWQodTR3CFwT8v0ciJz DE/cVRdJ3ax+FrrUwXEiixPYMmE9NcInIYhp2QEfFyLdcaUqDVSvDWEgCdo4J6e6G/yI dOcVp/Lcr4tGNo5uMJ/z9XPdwT5xqW6cktvnlRYTuLHQZMM/uwIlxlW97CxK776QX2Td 6X7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=fGBqfc2Yb7ffBuCcbEGM7TZH/G4A1wFOIdL+pttdZZw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=LfC5ZK0Vwg3U3ZoqdZg6dwi92h2njEc1q33bHd1rSwrxeTnDlKL9lxiGullqmWRyHe ci3/zlciHoJSyB4BKXBr3okIRpvYcQiAdSLvPfVT7AnPYRqr3mIQPNISZ9TE+lf/PW+w i6r5CKJgMPFfm1ZKNUnUnpYnaSwUXpaQMwQq2aIr9CtKmzNFeSxX9iDM1UMNJb2xeLvV 5b5fOgK95AWu1x3EeM3zgGzUr1AIe6OUya0SPhiZjNrqJekDwu4+cQHENz/DXjkKQjzQ RyXESoFL0HC+D1G2Z1eJnJYbkKxZc1Yrrt3ORdIxgU4nma+OBbF+T6Dh3A46YJ3Ugrq5 H6nA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=la+fglUH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 12-20020a056214202c00b006903099b236si6142108qvf.504.2024.03.11.12.22.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:22:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=la+fglUH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl7x-0005TM-Tc; Mon, 11 Mar 2024 15:16:04 -0400 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 1rjl4s-0003MA-Oa for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:54 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4q-0000MK-MD for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:50 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4132600824bso9416795e9.2 for ; Mon, 11 Mar 2024 12:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184366; x=1710789166; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=fGBqfc2Yb7ffBuCcbEGM7TZH/G4A1wFOIdL+pttdZZw=; b=la+fglUHuly6Hdv0x5TRg5v5Zo5+EQ18+7gga57ztCuVg1Co55kNDC0yWNnEgOARCm JIQaJeJWu2EvmmGk4ednb1teA2VSA/k0QO0uTeF5CbLoU7YPR27zX3+KdhMou5//x7S0 1tuAI9HH4jwlCEe7QLTH4vm3PzSZKq3UnC2WWVqbuaULfeoIXhc1Avn6TwevH9CwD+kx ytDOIXiI5lSWgIPeqYfRy+SD/sFC33AvH6SfhRiQcBPCCOM1bpC7Fs4NV0M1IecVw0Q9 okqmf1VcZBc+g7Cu/xt8bFosbnR/uur6GGoGN8nKVwbRaISTzvlyGq0fmrt6A+luwuhL NzzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184366; x=1710789166; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fGBqfc2Yb7ffBuCcbEGM7TZH/G4A1wFOIdL+pttdZZw=; b=qLkKf0nafrE2dpR3a/s34zPB4x/CVajpzV2cf5pgl+3ivpIffKnDj9ZaSqMDZ1ufpu 24R8WBSRE/BJVhHjP+/jwnMnp01VF9uUFkjyGjGeMkc1fAaF09iCsp+pvUcMvw6EMYjT F4+edbw6WTJJK1GgVUKIPovjEihGse1uprgXPThp/ucxuadHYhk2ukHHSYbn8FoznQze +wcu5JDp/ys/EnO5jqyvx4s76wa/IhagJCpDSu1bC7/wbORlGk4V8uV9AvzBtyE1vZ/7 NV3nr0cZzhQ289NtpLQMGkJ/c47pmlABx79ngQUGKonFKas6dzPokhxGWcUMxNn7nNz6 92sA== X-Gm-Message-State: AOJu0YyVreU2MjCPLJN9tgFm9nlXssNcg8ojzy/r+zKisZNUVQ6xYZbc KaAa7j4z/4rMNpVwqu1U1+Q/a41PnLFn+u7CDBtusrTsLIYXh11hed3pkx4O0wyrsJNeFG8HFTp n X-Received: by 2002:a05:600c:5116:b0:413:2e49:3e05 with SMTP id o22-20020a05600c511600b004132e493e05mr939809wms.12.1710184366242; Mon, 11 Mar 2024 12:12:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:45 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/20] contrib/elf2dmp: Fix error reporting style in download.c Date: Mon, 11 Mar 2024 19:12:28 +0000 Message-Id: <20240311191241.4177990-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki include/qapi/error.h says: > We recommend > * bool-valued functions return true on success / false on failure, > ... Signed-off-by: Akihiko Odaki Tested-by: Viktor Prutyanov Reviewed-by: Peter Maydell Message-id: 20240307-elf2dmp-v4-6-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/download.h | 2 +- contrib/elf2dmp/download.c | 10 +++++----- contrib/elf2dmp/main.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/elf2dmp/download.h b/contrib/elf2dmp/download.h index 5c274925f7a..f65adb5d089 100644 --- a/contrib/elf2dmp/download.h +++ b/contrib/elf2dmp/download.h @@ -8,6 +8,6 @@ #ifndef DOWNLOAD_H #define DOWNLOAD_H -int download_url(const char *name, const char *url); +bool download_url(const char *name, const char *url); #endif /* DOWNLOAD_H */ diff --git a/contrib/elf2dmp/download.c b/contrib/elf2dmp/download.c index 902dc04ffa5..21306b3fd4c 100644 --- a/contrib/elf2dmp/download.c +++ b/contrib/elf2dmp/download.c @@ -9,14 +9,14 @@ #include #include "download.h" -int download_url(const char *name, const char *url) +bool download_url(const char *name, const char *url) { - int err = 1; + bool success = false; FILE *file; CURL *curl = curl_easy_init(); if (!curl) { - return 1; + return false; } file = fopen(name, "wb"); @@ -33,11 +33,11 @@ int download_url(const char *name, const char *url) unlink(name); fclose(file); } else { - err = fclose(file); + success = !fclose(file); } out_curl: curl_easy_cleanup(curl); - return err; + return success; } diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index 09af39422f1..d295fd92be2 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -591,7 +591,7 @@ int main(int argc, char *argv[]) sprintf(pdb_url, "%s%s/%s/%s", SYM_URL_BASE, PDB_NAME, pdb_hash, PDB_NAME); printf("PDB URL is %s\n", pdb_url); - if (download_url(PDB_NAME, pdb_url)) { + if (!download_url(PDB_NAME, pdb_url)) { eprintf("Failed to download PDB file\n"); goto out_ps; } From patchwork Mon Mar 11 19:12:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779424 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1689639wrt; Mon, 11 Mar 2024 12:20:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWBY4JrJ3AHtAjsAYhHhHD3bL/gAHjX6wQABTyCGTYfxupE6RSYC9zXZC6T9I2nfqlTOC+yyun2k6ztuW3c75Lq X-Google-Smtp-Source: AGHT+IEbULajN19yNJCkwqXLkVR0fO8wVAHqWOzFG1lly95L6DMJNrUHTgIt4/Z5sDyWt9hKaCVU X-Received: by 2002:a25:dcd1:0:b0:dcb:e82c:f7f with SMTP id y200-20020a25dcd1000000b00dcbe82c0f7fmr4722009ybe.12.1710184834180; Mon, 11 Mar 2024 12:20:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184834; cv=none; d=google.com; s=arc-20160816; b=YY3cEgPMGRU7YFzc5n7oSLgEIUnDvrzh+MKZIYpmzz0zjDpuHJgzkyh9kk/80H7wl0 p0zd5NDQikjs76vjkxdZpSheJ/MpMctB8zmok/RaUueK00ysGpJf8TFCVy22EFp98Jba IqV+b4nVWX8IwSAnbrPrCLyXsaRz7tEFrwuJGUiOZsNGJw09zX4f+ja+bTN/E5HNqvt0 6IGemiPL4yPnXi9lBxyMJ/BZK7CK0vD9j/W6MTe7h/kfe3MQMZig5CqO+Cn+mbECz7uj n4sfnan+7s9YBxpyEbhv+rO/sgN7wTkCVvkMZWySuP94oU55/B84KV6gJUbYP77rAEYC V6gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=62mCtsOCyj3c3FuJKG39VRV6AssOCE2B0e0pxCJsMUw=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=rNMaK8CJdX4CS0NIirVUTReuyGz8GCCPVFvHyaz61H1FnKYBOVg0M5PsIQawaox+0d XPMi5KT+lhai7ivZ3QrATLQctqbPdVA2PtVatqc174KRJsQ0gNe/6st9CZ9nOkuoJtvw TznWYx4L6KbTWgmTE3z0PrzcYfLV2FV083Fp+Scuj4Cv6wRTpbWpLWokfHFvrNrBVEY3 cYQPosJnoNfwJV6kEh5IF0gF8itM1xP9Ywjwy0nyarH+j7/5UPRz7r/ZqvNQ2q0+puN4 5MQhO9gH2KQG3bfiy3Oh7ghRfbp9KNKVc6jO5EllKpM8UkWkP7Z/zZFj9dccTgy9tRLE cKnw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KbyfHT1a; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g7-20020ac87f47000000b0042f0b0c906fsi6225078qtk.376.2024.03.11.12.20.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:20:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KbyfHT1a; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl5y-0003zU-NN; Mon, 11 Mar 2024 15:14:00 -0400 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 1rjl4s-0003M8-Eh for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:54 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4q-0000MX-EF for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:50 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4132fbac6faso4751115e9.1 for ; Mon, 11 Mar 2024 12:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184367; x=1710789167; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=62mCtsOCyj3c3FuJKG39VRV6AssOCE2B0e0pxCJsMUw=; b=KbyfHT1agQqlst60UIntM9J7eHNRf1TeDVMNfFjPzzr9nwVUy7ID0EunUW8NcsegFR AacItX4qnnFJtFa1k1IecDJ8qcxPhNCrVWfne6X/wZgmkvmPzB9CErq+RhzS3PTLgZzu qFG6jqpY0CTFkyHPw87g0WM7l4VCG/7+qzesXpJhJffrE63QCZWwbRB/Nxh23ySMCb2v S03GX0NX5PAWl4O45af90otYTSEiYiaRMZ4kP6d7cf3H63IyRtAR148IsyaU+1YZMQBQ BpdUQ8W7CVaEIbKXFZ3+Xr9BSfLZ1+CJcYUIWxDd0IOQGNizSwrCSjwBsg6oLZaVHRis qW4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184367; x=1710789167; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=62mCtsOCyj3c3FuJKG39VRV6AssOCE2B0e0pxCJsMUw=; b=ZFltMmUgENhxeDWvBM0jmKRLUrmDhkJPkuKtA200/zinM7FDy56fANYileFWuHPC7u ZuDHuZFjjwxbC0oDl/HADG5csX3U4eOOh/H5StjJFqe1dwbJa8pCPmPjVtE+0tJEbu0i XEAcXB6Iew0KemKsFxnSejZ8uRBzPaNBKIINOoYoE+zU2jWM0k9sOGWW1nvnRWoWIEM+ YEEC6iSu9GHXeBarc2KBe62d43KubukaPBLiYyQR//bkYqihqOhszb9dFNo+aarMXEsy CYtfV4jQM7xZjud7pX7z8HZnoRQ/6eNGQuBqQebKO+F74AR+tx9jLChsjmz8y/Vq1GRV tmOg== X-Gm-Message-State: AOJu0YzeckBNkMu0w4dUZea+kZFcf6K1iKD1E1AltIh13uaXaG1kkKrD xheTmEss9GjPOwe7pB3Hp5Th6p4DDBTn1j+cQ1UVLi/dRThAfj0tbUV8S2wlJD1p5StprBmyxQb z X-Received: by 2002:a05:600c:1c16:b0:413:1ae3:6ad1 with SMTP id j22-20020a05600c1c1600b004131ae36ad1mr5974777wms.15.1710184366713; Mon, 11 Mar 2024 12:12:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:46 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/20] contrib/elf2dmp: Fix error reporting style in pdb.c Date: Mon, 11 Mar 2024 19:12:29 +0000 Message-Id: <20240311191241.4177990-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki include/qapi/error.h says: > We recommend > * bool-valued functions return true on success / false on failure, > ... Signed-off-by: Akihiko Odaki Tested-by: Viktor Prutyanov Reviewed-by: Peter Maydell Message-id: 20240307-elf2dmp-v4-7-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/pdb.h | 2 +- contrib/elf2dmp/main.c | 2 +- contrib/elf2dmp/pdb.c | 50 +++++++++++++++++++++--------------------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/contrib/elf2dmp/pdb.h b/contrib/elf2dmp/pdb.h index 2a50da56ac9..feddf1862f0 100644 --- a/contrib/elf2dmp/pdb.h +++ b/contrib/elf2dmp/pdb.h @@ -233,7 +233,7 @@ struct pdb_reader { size_t segs_size; }; -int pdb_init_from_file(const char *name, struct pdb_reader *reader); +bool pdb_init_from_file(const char *name, struct pdb_reader *reader); void pdb_exit(struct pdb_reader *reader); uint64_t pdb_resolve(uint64_t img_base, struct pdb_reader *r, const char *name); uint64_t pdb_find_public_v3_symbol(struct pdb_reader *reader, const char *name); diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index d295fd92be2..7a3a7225905 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -596,7 +596,7 @@ int main(int argc, char *argv[]) goto out_ps; } - if (pdb_init_from_file(PDB_NAME, &pdb)) { + if (!pdb_init_from_file(PDB_NAME, &pdb)) { eprintf("Failed to initialize PDB reader\n"); goto out_pdb_file; } diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c index abf17c2e7c1..1c505142518 100644 --- a/contrib/elf2dmp/pdb.c +++ b/contrib/elf2dmp/pdb.c @@ -158,30 +158,30 @@ static void *pdb_ds_read_file(struct pdb_reader* r, uint32_t file_number) return pdb_ds_read(r->ds.header, block_list, file_size[file_number]); } -static int pdb_init_segments(struct pdb_reader *r) +static bool pdb_init_segments(struct pdb_reader *r) { unsigned stream_idx = r->segments; r->segs = pdb_ds_read_file(r, stream_idx); if (!r->segs) { - return 1; + return false; } r->segs_size = pdb_get_file_size(r, stream_idx); if (!r->segs_size) { - return 1; + return false; } - return 0; + return true; } -static int pdb_init_symbols(struct pdb_reader *r) +static bool pdb_init_symbols(struct pdb_reader *r) { PDB_SYMBOLS *symbols; symbols = pdb_ds_read_file(r, 3); if (!symbols) { - return 1; + return false; } r->symbols = symbols; @@ -198,18 +198,18 @@ static int pdb_init_symbols(struct pdb_reader *r) goto out_symbols; } - return 0; + return true; out_symbols: g_free(symbols); - return 1; + return false; } -static int pdb_reader_ds_init(struct pdb_reader *r, PDB_DS_HEADER *hdr) +static bool pdb_reader_ds_init(struct pdb_reader *r, PDB_DS_HEADER *hdr) { if (hdr->block_size == 0) { - return 1; + return false; } memset(r->file_used, 0, sizeof(r->file_used)); @@ -218,22 +218,22 @@ static int pdb_reader_ds_init(struct pdb_reader *r, PDB_DS_HEADER *hdr) hdr->toc_page * hdr->block_size), hdr->toc_size); if (!r->ds.toc) { - return 1; + return false; } - return 0; + return true; } -static int pdb_reader_init(struct pdb_reader *r, void *data) +static bool pdb_reader_init(struct pdb_reader *r, void *data) { const char pdb7[] = "Microsoft C/C++ MSF 7.00"; if (memcmp(data, pdb7, sizeof(pdb7) - 1)) { - return 1; + return false; } - if (pdb_reader_ds_init(r, data)) { - return 1; + if (!pdb_reader_ds_init(r, data)) { + return false; } r->ds.root = pdb_ds_read_file(r, 1); @@ -241,15 +241,15 @@ static int pdb_reader_init(struct pdb_reader *r, void *data) goto out_ds; } - if (pdb_init_symbols(r)) { + if (!pdb_init_symbols(r)) { goto out_root; } - if (pdb_init_segments(r)) { + if (!pdb_init_segments(r)) { goto out_sym; } - return 0; + return true; out_sym: pdb_exit_symbols(r); @@ -258,7 +258,7 @@ out_root: out_ds: pdb_reader_ds_exit(r); - return 1; + return false; } static void pdb_reader_exit(struct pdb_reader *r) @@ -269,7 +269,7 @@ static void pdb_reader_exit(struct pdb_reader *r) pdb_reader_ds_exit(r); } -int pdb_init_from_file(const char *name, struct pdb_reader *reader) +bool pdb_init_from_file(const char *name, struct pdb_reader *reader) { GError *gerr = NULL; void *map; @@ -278,21 +278,21 @@ int pdb_init_from_file(const char *name, struct pdb_reader *reader) if (gerr) { eprintf("Failed to map PDB file \'%s\'\n", name); g_error_free(gerr); - return 1; + return false; } reader->file_size = g_mapped_file_get_length(reader->gmf); map = g_mapped_file_get_contents(reader->gmf); - if (pdb_reader_init(reader, map)) { + if (!pdb_reader_init(reader, map)) { goto out_unmap; } - return 0; + return true; out_unmap: g_mapped_file_unref(reader->gmf); - return 1; + return false; } void pdb_exit(struct pdb_reader *reader) From patchwork Mon Mar 11 19:12:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779438 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1690557wrt; Mon, 11 Mar 2024 12:23:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUyYepeudfMDbSXuuIXsvCXD7CDSsMYGNU0uMoYc1R5cZdq9dgUcEd56/Yh9zLTdZ0i6IF844uQ0AC4MP6mCtpZ X-Google-Smtp-Source: AGHT+IHuAr1MMRET/bl1wS7EG1ZwukZgmCMFRSCgT5zgeIiZUVP/bxDGtxhyy0wqOJPMZVSjTurA X-Received: by 2002:a05:6808:6245:b0:3c2:3341:f2f4 with SMTP id dt5-20020a056808624500b003c23341f2f4mr7387881oib.18.1710184982379; Mon, 11 Mar 2024 12:23:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184982; cv=none; d=google.com; s=arc-20160816; b=uUVe6CG3JzJ0YM908ACZX5S7X+8MRNAer2mwdoERPXXHU3YMehDSvxLn/q/28JDcQA AbcbkMHgV07DJyXBZa3AYs2PLaZnGhgYs+XFMXFXqOlYZ70++DM9UsWZen9ijaUFIutW 0Rt/m59VF8H1+d5XkDNynXDoz4CT5A3GxRI2l15uhsu5Se898a+4duAAhI3AQYoVcmL+ AuHEsYnjiB83QBM+lVP2iYEz6JNaGKsptNg01dSN2c12DOndBk1i0eKpcQ02i5VBCcBy WoR1hFtn77AN+Pr1viQj2jqRBsJZ8rb6If+MVN3QPT7vUf50bO9B0PFlbzC94JMt1yt9 NGwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ZKRgQA/0ld0Nx08VQWNukHwwGQ+d9ybOAarqZYkU/Wk=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=xrZj+Snf3wE1yqzyJRNg/pIrz5jyLU/X7ZiB4YAaKTMzrVpZ6F86xKZRFO4q3f4mdO ZtUNkCSaYDNQXSIAVl30VjX+n/PQDcw+EH22jdU7JOjxy52gfnwnbvM7vd47kFd6OGkc 4VM5IWWvJEx7aAPcCZZBKtOW/tFsxcQOKek1nuV3U8yQFNt6FIQU5moVrwnmI0XOkMds OBgGfQNWf5RETq8N/nP4ZkzBj9wj/vUVgRBFUhsqRJVizbb30gn09CtPPht9UGx7hSGz mvxLgAyXpVm6xM5mRzd9FkLGMXaVWbgi9s4SIUUGQDSLNdIoVCWM3By4pCiExRnqxsJ9 QXOw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eSua3Q4p; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t26-20020a05622a181a00b0042f30745d14si6180479qtc.205.2024.03.11.12.23.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:23:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eSua3Q4p; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl9u-0007Hx-FC; Mon, 11 Mar 2024 15:18:02 -0400 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 1rjl57-0003R1-G2 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:09 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4s-0000Mc-HF for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:05 -0400 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-513173e8191so4648910e87.1 for ; Mon, 11 Mar 2024 12:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184367; x=1710789167; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ZKRgQA/0ld0Nx08VQWNukHwwGQ+d9ybOAarqZYkU/Wk=; b=eSua3Q4pfY5Xj46/eQvHcGv0yDFxOuUH3hdFEYl75d+9CrMA4rJfFeXq4pPzkLbqol Ooa731wYNf0EagSFjwsIix6ph8H9KlQzyv8oo+9rtg4IeLPYqVjcAnk8avGz3GLG65ea LxQfXVMvq1dXk6Kc74mEUS2xqOnRJH7KChp2Ny4XUgdvjLnKeAhzvcAuzGlqRL53IW8X KgIgR1AJHfGnbO174kDWIym7cIqldabhHWu1luZ+7r0eK1j08K5R+rbx3QPWAnwhbUXK amNeXOC900+kJew3dd60PynNqUTEEWc4Ov4/ILEY/gtaKQaa7L+v5K89xehL/zivAFzz pPdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184367; x=1710789167; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZKRgQA/0ld0Nx08VQWNukHwwGQ+d9ybOAarqZYkU/Wk=; b=Uj9ycY0bos3R9qQPNIobCtpm9skI6QXuvDEc8czRgy4ssyRi9sQSsLfLnic0dTshyu 0IJeZandn8pEtX5WJ+qJN1bTHuF6eF+khLwop/t4TkRNv5mN63O6Brq5A17p4R/x0dPF 3++Z0IaKtwtFJfW1WUt1uq9DNktbYHSTZLbGPBRBs3KPWABp4hmZsVT6hNMN+f0MDFWx rdTo2iIjG82K+ens/8JD9sk8rKTdusUTYm7kOJrlcQYErmja6uedjS2WY4JZgVTRZEc6 V2aY8K4K2IP9Si2gi21uaPxgMfFJDLqKMZuxeYKxzFKaTR2ZRMaOJv7XNxuppkrEWKXd 3PhQ== X-Gm-Message-State: AOJu0YzJ0GU62FxxQy3NfjD5puEAYw9k1gpcdqu60vZottnEAXMR1eGM v2Y1V4gkD+CyVDrjCiuwMLOiZFs7/T9aVFPjtJzcChHY5bz93iarf2hqqorRrvzKSTGIFL0h2bW X X-Received: by 2002:a05:6512:2823:b0:513:42e:ddf0 with SMTP id cf35-20020a056512282300b00513042eddf0mr6981266lfb.36.1710184367095; Mon, 11 Mar 2024 12:12:47 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:46 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/20] contrib/elf2dmp: Fix error reporting style in qemu_elf.c Date: Mon, 11 Mar 2024 19:12:30 +0000 Message-Id: <20240311191241.4177990-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x131.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki include/qapi/error.h says: > We recommend > * bool-valued functions return true on success / false on failure, > ... Signed-off-by: Akihiko Odaki Tested-by: Viktor Prutyanov Reviewed-by: Peter Maydell Message-id: 20240307-elf2dmp-v4-8-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/qemu_elf.h | 2 +- contrib/elf2dmp/main.c | 2 +- contrib/elf2dmp/qemu_elf.c | 32 ++++++++++++++++---------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/contrib/elf2dmp/qemu_elf.h b/contrib/elf2dmp/qemu_elf.h index afa75f10b2d..adc50238b46 100644 --- a/contrib/elf2dmp/qemu_elf.h +++ b/contrib/elf2dmp/qemu_elf.h @@ -42,7 +42,7 @@ typedef struct QEMU_Elf { int has_kernel_gs_base; } QEMU_Elf; -int QEMU_Elf_init(QEMU_Elf *qe, const char *filename); +bool QEMU_Elf_init(QEMU_Elf *qe, const char *filename); void QEMU_Elf_exit(QEMU_Elf *qe); Elf64_Phdr *elf64_getphdr(void *map); diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index 7a3a7225905..cb28971789e 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -535,7 +535,7 @@ int main(int argc, char *argv[]) return 1; } - if (QEMU_Elf_init(&qemu_elf, argv[1])) { + if (!QEMU_Elf_init(&qemu_elf, argv[1])) { eprintf("Failed to initialize QEMU ELF dump\n"); return 1; } diff --git a/contrib/elf2dmp/qemu_elf.c b/contrib/elf2dmp/qemu_elf.c index 055e6f8792e..a22c057d3ec 100644 --- a/contrib/elf2dmp/qemu_elf.c +++ b/contrib/elf2dmp/qemu_elf.c @@ -60,7 +60,7 @@ Elf64_Half elf_getphdrnum(void *map) return ehdr->e_phnum; } -static int init_states(QEMU_Elf *qe) +static bool init_states(QEMU_Elf *qe) { Elf64_Phdr *phdr = elf64_getphdr(qe->map); Elf64_Nhdr *start = (void *)((uint8_t *)qe->map + phdr[0].p_offset); @@ -70,7 +70,7 @@ static int init_states(QEMU_Elf *qe) if (phdr[0].p_type != PT_NOTE) { eprintf("Failed to find PT_NOTE\n"); - return 1; + return false; } qe->has_kernel_gs_base = 1; @@ -107,7 +107,7 @@ static int init_states(QEMU_Elf *qe) qe->state_nr = cpu_nr; - return 0; + return true; } static void exit_states(QEMU_Elf *qe) @@ -162,7 +162,7 @@ static bool check_ehdr(QEMU_Elf *qe) return true; } -static int QEMU_Elf_map(QEMU_Elf *qe, const char *filename) +static bool QEMU_Elf_map(QEMU_Elf *qe, const char *filename) { #ifdef CONFIG_LINUX struct stat st; @@ -173,13 +173,13 @@ static int QEMU_Elf_map(QEMU_Elf *qe, const char *filename) fd = open(filename, O_RDONLY, 0); if (fd == -1) { eprintf("Failed to open ELF dump file \'%s\'\n", filename); - return 1; + return false; } if (fstat(fd, &st)) { eprintf("Failed to get size of ELF dump file\n"); close(fd); - return 1; + return false; } qe->size = st.st_size; @@ -188,7 +188,7 @@ static int QEMU_Elf_map(QEMU_Elf *qe, const char *filename) if (qe->map == MAP_FAILED) { eprintf("Failed to map ELF file\n"); close(fd); - return 1; + return false; } close(fd); @@ -201,14 +201,14 @@ static int QEMU_Elf_map(QEMU_Elf *qe, const char *filename) if (gerr) { eprintf("Failed to map ELF dump file \'%s\'\n", filename); g_error_free(gerr); - return 1; + return false; } qe->map = g_mapped_file_get_contents(qe->gmf); qe->size = g_mapped_file_get_length(qe->gmf); #endif - return 0; + return true; } static void QEMU_Elf_unmap(QEMU_Elf *qe) @@ -220,25 +220,25 @@ static void QEMU_Elf_unmap(QEMU_Elf *qe) #endif } -int QEMU_Elf_init(QEMU_Elf *qe, const char *filename) +bool QEMU_Elf_init(QEMU_Elf *qe, const char *filename) { - if (QEMU_Elf_map(qe, filename)) { - return 1; + if (!QEMU_Elf_map(qe, filename)) { + return false; } if (!check_ehdr(qe)) { eprintf("Input file has the wrong format\n"); QEMU_Elf_unmap(qe); - return 1; + return false; } - if (init_states(qe)) { + if (!init_states(qe)) { eprintf("Failed to extract QEMU CPU states\n"); QEMU_Elf_unmap(qe); - return 1; + return false; } - return 0; + return true; } void QEMU_Elf_exit(QEMU_Elf *qe) From patchwork Mon Mar 11 19:12:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779422 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1688781wrt; Mon, 11 Mar 2024 12:18:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXoiBjJFrN7HVaA7XTLLJbgOV1cxlwZs7EEpWII27qCrzKegybl6NG7eJG7mAJqGe2yuip+OYPc+x8b0azjdTKJ X-Google-Smtp-Source: AGHT+IHSK4laW9JS3y1TPqlLhKAvxMEiLDuJnyinwaflKV6+mG5DEo158u9sgMMpU68a1w8RvEeb X-Received: by 2002:a05:6808:159a:b0:3c2:51f8:f0f9 with SMTP id t26-20020a056808159a00b003c251f8f0f9mr2427516oiw.18.1710184706713; Mon, 11 Mar 2024 12:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184706; cv=none; d=google.com; s=arc-20160816; b=z8XKA2RtAyIAP12u5B3VLp9/cmOn4YMbtmZFb9vqOKxaPIZlpETeE/IUYT34M/0Qfo R4tD24SE4usC34QYkzkxXemE2Bbv8Z43goCnVG+z2JnjNbsTw1R18FOG1Bi8nvEUnKM9 8V5D9AlFmLAJnqvx/3fTBwhGBigizlUP4DITfDs1XPDxS7cUcoKxiF20vvWBLC8U4MV4 TFq72XVWogX4W43TA/jQrilLMAmljg1Q90B5tZDGCQ0ZyU5us3llLrdmooWjvCLXRfAl o1cvBxsRJfdmpcSBSi2E14N0dUeMj9Mb+oY/cLLHmEEcHb6I3jUTsc168m7rdJUxY0oz q6mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=yBgzhXasfX7o3A8onUx+4Fu5/1iVNFXdpdqXuKLdnRM=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=dkIiUv9TNUR6kFaYks9Sw0JWS7P2kkSfIVjtTM+rb3VCwWx89IXI/d5hg73JA80aGz pUpIIOq40zQ8rVMHnz9U4B4TCiYSlwfV7doT/fZhLMwAqmrA/0tChERAiu+DQRMZuJ/o 2TPvOOtbVr/lq5DE3bsdFWTGiTXktUVmZJxmXIL65vRiLvscWWMW0+BtCtiSDQwnZtTD y3HpY3qHig12Zevv7BLjfOLGs3AxFMdc1Q6F7AEFGxqzdWxl6ktFLDQCfDNyGaEOcBAU p11MZVR1FAj2jpstHh0wyMvJHjE8Qd1Dpulb+IjrjxPeYpKPlrz6n1o8VBqicyIHv56C V5yw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e6WxWNCb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n3-20020ac85a03000000b0042ed731ad3esi6079555qta.598.2024.03.11.12.18.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:18:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e6WxWNCb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl6k-0004jS-Ts; Mon, 11 Mar 2024 15:14:51 -0400 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 1rjl4y-0003OU-6K for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:02 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4s-0000Mh-AE for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:55 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4132fc7dea7so4379085e9.3 for ; Mon, 11 Mar 2024 12:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184367; x=1710789167; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yBgzhXasfX7o3A8onUx+4Fu5/1iVNFXdpdqXuKLdnRM=; b=e6WxWNCbNLK1jix6sLXRHhLwWvaBTyHTvaYf9Vx37SMiQJoouy/8gVpLC4Pu/Jh8Xa KEX1cilBGtw9TG6VW65h8JfecpIyNbC3/4/FsdyCfFDxgw/Ti8QjyzRABxze5wvHvgG4 3kOPC+Poh0ZHcOmEG+gYFH+3m7QjTapF6LYQf09e/4ib9C31EJPRk4Q27G/KLKrJ8nKn +WDLps1Aa8OItdc8iQ/ru0bh9iQ2k42gDJWdrKGIgEXGhk53TqUPgCbO9U0PUf+H04AD DH1XW7VlfCPN8LLrtqf5S2bGdjsFx39b85BEfCoGR4mnaZCGXwMNiXIyi3VAJRXPsW8S vqcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184367; x=1710789167; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yBgzhXasfX7o3A8onUx+4Fu5/1iVNFXdpdqXuKLdnRM=; b=X7q8bkonpR3c3H1G9OdTSQedvx43xDebtU+hTvp8NxKY2gKsriHKKFR+jOgpK3Tf22 KmtuuVTxWzz0EGjrQJUQ3L4y8ObxGjQW08xuOzFCge/pwTylIn35DqctenLaG57jsV5O wESX0/Kx5Ev86F69/1+DEyh8It1LXsoPiI3ic32evoyvYjAtES1nOBOd7OG8WAvqy+Jh 5JhK2RtCwlUf+Uox67JtW9z8yoUHcajLtR8eHNaPq3Zd0a66QyH0yheNrPAxfcTu7y4b T715eoyrgzzbgkc9ZstoXHk1GCY99dq4AzvJeg/ym9lTDfNQ3D0C1WTp05ifgOh8TBA6 c6Aw== X-Gm-Message-State: AOJu0YzpxhnXEsp/Penlmnm5BVlOv8YlFeU8MAajlvPwrvtx+cX1Lj52 uL0syaiFP8d3bOW0XNsjSdtyeKCExQLgLWHBZH1wlPxA0ARqkb2KSu09V6iSDdIskbmawmCyclm e X-Received: by 2002:a05:600c:5109:b0:413:2925:ffa0 with SMTP id o9-20020a05600c510900b004132925ffa0mr3183632wms.18.1710184367619; Mon, 11 Mar 2024 12:12:47 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:47 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/20] contrib/elf2dmp: Fix error reporting style in main.c Date: Mon, 11 Mar 2024 19:12:31 +0000 Message-Id: <20240311191241.4177990-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki include/qapi/error.h says: > We recommend > * bool-valued functions return true on success / false on failure, > ... Signed-off-by: Akihiko Odaki Tested-by: Viktor Prutyanov Reviewed-by: Peter Maydell Message-id: 20240307-elf2dmp-v4-9-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/main.c | 63 +++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index cb28971789e..9347b0cd5a2 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -186,13 +186,13 @@ static void win_context_init_from_qemu_cpu_state(WinContext64 *ctx, * Finds paging-structure hierarchy base, * if previously set doesn't give access to kernel structures */ -static int fix_dtb(struct va_space *vs, QEMU_Elf *qe) +static bool fix_dtb(struct va_space *vs, QEMU_Elf *qe) { /* * Firstly, test previously set DTB. */ if (va_space_resolve(vs, SharedUserData)) { - return 0; + return true; } /* @@ -206,7 +206,7 @@ static int fix_dtb(struct va_space *vs, QEMU_Elf *qe) va_space_set_dtb(vs, s->cr[3]); printf("DTB 0x%016"PRIx64" has been found from CPU #%zu" " as system task CR3\n", vs->dtb, i); - return !(va_space_resolve(vs, SharedUserData)); + return va_space_resolve(vs, SharedUserData); } } @@ -220,16 +220,16 @@ static int fix_dtb(struct va_space *vs, QEMU_Elf *qe) uint64_t *cr3 = va_space_resolve(vs, Prcb + 0x7000); if (!cr3) { - return 1; + return false; } va_space_set_dtb(vs, *cr3); printf("DirectoryTableBase = 0x%016"PRIx64" has been found from CPU #0" " as interrupt handling CR3\n", vs->dtb); - return !(va_space_resolve(vs, SharedUserData)); + return va_space_resolve(vs, SharedUserData); } - return 1; + return true; } static void try_merge_runs(struct pa_space *ps, @@ -268,9 +268,10 @@ static void try_merge_runs(struct pa_space *ps, } } -static int fill_header(WinDumpHeader64 *hdr, struct pa_space *ps, - struct va_space *vs, uint64_t KdDebuggerDataBlock, - KDDEBUGGER_DATA64 *kdbg, uint64_t KdVersionBlock, int nr_cpus) +static bool fill_header(WinDumpHeader64 *hdr, struct pa_space *ps, + struct va_space *vs, uint64_t KdDebuggerDataBlock, + KDDEBUGGER_DATA64 *kdbg, uint64_t KdVersionBlock, + int nr_cpus) { uint32_t *suite_mask = va_space_resolve(vs, SharedUserData + KUSD_OFFSET_SUITE_MASK); @@ -283,12 +284,12 @@ static int fill_header(WinDumpHeader64 *hdr, struct pa_space *ps, QEMU_BUILD_BUG_ON(KUSD_OFFSET_PRODUCT_TYPE >= ELF2DMP_PAGE_SIZE); if (!suite_mask || !product_type) { - return 1; + return false; } if (!va_space_rw(vs, KdVersionBlock, &kvb, sizeof(kvb), 0)) { eprintf("Failed to extract KdVersionBlock\n"); - return 1; + return false; } h = (WinDumpHeader64) { @@ -333,7 +334,7 @@ static int fill_header(WinDumpHeader64 *hdr, struct pa_space *ps, *hdr = h; - return 0; + return true; } /* @@ -379,8 +380,8 @@ static void fill_context(KDDEBUGGER_DATA64 *kdbg, } } -static int pe_get_data_dir_entry(uint64_t base, void *start_addr, int idx, - void *entry, size_t size, struct va_space *vs) +static bool pe_get_data_dir_entry(uint64_t base, void *start_addr, int idx, + void *entry, size_t size, struct va_space *vs) { const char e_magic[2] = "MZ"; const char Signature[4] = "PE\0\0"; @@ -393,38 +394,38 @@ static int pe_get_data_dir_entry(uint64_t base, void *start_addr, int idx, QEMU_BUILD_BUG_ON(sizeof(*dos_hdr) >= ELF2DMP_PAGE_SIZE); if (memcmp(&dos_hdr->e_magic, e_magic, sizeof(e_magic))) { - return 1; + return false; } if (!va_space_rw(vs, base + dos_hdr->e_lfanew, &nt_hdrs, sizeof(nt_hdrs), 0)) { - return 1; + return false; } if (memcmp(&nt_hdrs.Signature, Signature, sizeof(Signature)) || file_hdr->Machine != 0x8664 || opt_hdr->Magic != 0x020b) { - return 1; + return false; } if (!va_space_rw(vs, base + data_dir[idx].VirtualAddress, entry, size, 0)) { - return 1; + return false; } printf("Data directory entry #%d: RVA = 0x%08"PRIx32"\n", idx, (uint32_t)data_dir[idx].VirtualAddress); - return 0; + return true; } -static int write_dump(struct pa_space *ps, - WinDumpHeader64 *hdr, const char *name) +static bool write_dump(struct pa_space *ps, + WinDumpHeader64 *hdr, const char *name) { FILE *dmp_file = fopen(name, "wb"); size_t i; if (!dmp_file) { eprintf("Failed to open output file \'%s\'\n", name); - return 1; + return false; } printf("Writing header to file...\n"); @@ -432,7 +433,7 @@ static int write_dump(struct pa_space *ps, if (fwrite(hdr, sizeof(*hdr), 1, dmp_file) != 1) { eprintf("Failed to write dump header\n"); fclose(dmp_file); - return 1; + return false; } for (i = 0; i < ps->block_nr; i++) { @@ -443,11 +444,11 @@ static int write_dump(struct pa_space *ps, if (fwrite(b->addr, b->size, 1, dmp_file) != 1) { eprintf("Failed to write block\n"); fclose(dmp_file); - return 1; + return false; } } - return fclose(dmp_file); + return !fclose(dmp_file); } static bool pe_check_pdb_name(uint64_t base, void *start_addr, @@ -457,8 +458,8 @@ static bool pe_check_pdb_name(uint64_t base, void *start_addr, IMAGE_DEBUG_DIRECTORY debug_dir; char pdb_name[sizeof(PDB_NAME)]; - if (pe_get_data_dir_entry(base, start_addr, IMAGE_FILE_DEBUG_DIRECTORY, - &debug_dir, sizeof(debug_dir), vs)) { + if (!pe_get_data_dir_entry(base, start_addr, IMAGE_FILE_DEBUG_DIRECTORY, + &debug_dir, sizeof(debug_dir), vs)) { eprintf("Failed to get Debug Directory\n"); return false; } @@ -546,7 +547,7 @@ int main(int argc, char *argv[]) printf("CPU #0 CR3 is 0x%016"PRIx64"\n", state->cr[3]); va_space_create(&vs, &ps, state->cr[3]); - if (fix_dtb(&vs, &qemu_elf)) { + if (!fix_dtb(&vs, &qemu_elf)) { eprintf("Failed to find paging base\n"); goto out_elf; } @@ -611,14 +612,14 @@ int main(int argc, char *argv[]) goto out_pdb; } - if (fill_header(&header, &ps, &vs, KdDebuggerDataBlock, kdbg, - KdVersionBlock, qemu_elf.state_nr)) { + if (!fill_header(&header, &ps, &vs, KdDebuggerDataBlock, kdbg, + KdVersionBlock, qemu_elf.state_nr)) { goto out_kdbg; } fill_context(kdbg, &vs, &qemu_elf); - if (write_dump(&ps, &header, argv[2])) { + if (!write_dump(&ps, &header, argv[2])) { eprintf("Failed to save dump\n"); goto out_kdbg; } From patchwork Mon Mar 11 19:12:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779421 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1688128wrt; Mon, 11 Mar 2024 12:16:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWknmPtrjve3f/gF1nEDbOZxjsrpbKPbr1e2sHqapEzUklVG2k/5SfMtljFq3QmvUjA1JLQhmwlAADyULwkill3 X-Google-Smtp-Source: AGHT+IGIY22s57nNkN0UPx4BWYibGcNc5NjxZ4P5Ft5Uyl5zEzWS+VkzbcPOOnGBgEZQ9TnW1tIT X-Received: by 2002:a1f:f44b:0:b0:4d3:4aad:a8c6 with SMTP id s72-20020a1ff44b000000b004d34aada8c6mr3495737vkh.0.1710184607192; Mon, 11 Mar 2024 12:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184607; cv=none; d=google.com; s=arc-20160816; b=sq3+Ey+BB6ZfvE1E4aPiiTw1H6z63iXBFIud0jBpn7Q0zGUpT1ZjdfBnU+lQN3Wqan 2cdzTHO51gD9gWFfkMRIM76LR7Mhr7RqP3+j3YwDNxZCDM/5ayzJSz+ibU/yYUFexeMN e3MQoetCfmtfHO0kPEwL1148G90bkZWDLQF7eu2tIJlJfDtE+HgjCsVg7SG3YhhB/sPu FyVb2Z1X/Q90MM1V9LhwzM+lijnmqz7zFwnhTpFGWoosfskezVi4xk8gFdraSNYHItIc 27hJgL1LD631OecyZzg92PkOB++bxiJpncN+gWE4dzoiSzkSB6gJDIjcadoIwpeNmwXG 9PcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=D8bGr2tLFSsGuLe+R12MdDwd+oLrPAXm9STkJvPYqVM=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=T8Qnjg1jp1D23QWjaqvnrE70EeYCqqgwP1Wvj33wnzxkizYK7IVGpvuRAXtzJMwZFU nHmTL5HNyJufcGv1qtV/1owg+hZqs9fjnuCPOKWUIjxLEtvWl2g/25FZLFGSMuxUelYH mBO2CEo9bV/QbtGsIN2sFfgP1uFX+flDMGH55JlGF/CxoM1zMmE2FBKJ/TTSskSEEyTY I99Gx0OkiIWBEMArH5No/RCFNYqVN+9BZybCltairb2VxxKwqPNfKScJ4ZrewCxNQxlr ZBuA1kT72MNysuF4m6JAbt/8aDjx4ew4ud+tSP1uPrCHqfWwEeErmF7iFYcK0BRhuB55 ruZA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tvraFvxp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ch20-20020a056122319400b004d346608fb9si814981vkb.176.2024.03.11.12.16.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:16:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tvraFvxp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl7N-0005GQ-39; Mon, 11 Mar 2024 15:15:25 -0400 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 1rjl54-0003Pb-E7 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:04 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4t-0000Mr-5k for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:01 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-33d90dfe73cso2759926f8f.0 for ; Mon, 11 Mar 2024 12:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184368; x=1710789168; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=D8bGr2tLFSsGuLe+R12MdDwd+oLrPAXm9STkJvPYqVM=; b=tvraFvxp8EQN0Mh2FPTasCiYmAPikVvR4BJOSJWyckmLXfsEtVbN1GvRU0LfOlsXXb Zz8GcT6pP4p9rRPUoMJ9J2RwqBNAWHUaUodnY6ZNB7neJLoS3d2l/RPmB8DMiF1pSTdI bq9YmGg6FTGxe4snUOBtMxNWsn7aXSV6G1F1XSdE8T/S/UTy/7DLp/f4IpGBCFiwfHAM tsxLoK5RVaJ947f+nSXZtWcKrLZAOTrO2k/4xHS0RcFO5njWVLOsOqN6YfgD+lpd+L58 kT3a1vMEoMhJePC3/MmuwpnzxrKiQn7EMCpqeleiHviQjrnCu0CpkhJntrPSVBlEM+L6 9SqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184368; x=1710789168; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D8bGr2tLFSsGuLe+R12MdDwd+oLrPAXm9STkJvPYqVM=; b=xTAzBWEPjmju4XK4LqAlUFvnsB7efMeJDpBeimy5RKnOsl8RSiqNJqJJ48KrhG07CT 3PmMLsBF2Z+L0vPdcsIeVTzr0SaRvk4j8vvbJbbOgHBL1b+z6gAKexpusrR5G91ctkoN JePLr5r0xXpbf7GuPJp0ByNtzt7GnhFtXjUAylF2lIZU8O03fg4qZF+xcdAZFyTcLETq IUhGtzPBt7JOYxbCX7pBYvGYdxMBxXnzuMRDtPS3wbOj73rzJJOjKTM299fTOJltniQF IVguaPD+aJYfREql0xfObVEk9xDlUmO/hwk/QwGCFOXD3cXqoZO/ElEFunWksWrCZJIn pHKg== X-Gm-Message-State: AOJu0YyQCVgJnUb1sP519VRHjiciphTln7Be5FuGoWrnIb3bncYaqUNq OTMn7Gi75VBOgfYiiBCzdKBAcygY9QDlDTS/eSE23ukUj28+m/VXulWBOxpq3QPG1LeSzsynX/S I X-Received: by 2002:a05:6000:22e:b0:33e:7b39:6739 with SMTP id l14-20020a056000022e00b0033e7b396739mr7753343wrz.0.1710184367981; Mon, 11 Mar 2024 12:12:47 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:47 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/20] contrib/elf2dmp: Always check for PA resolution failure Date: Mon, 11 Mar 2024 19:12:32 +0000 Message-Id: <20240311191241.4177990-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki Not checking PA resolution failure can result in NULL deference. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Tested-by: Viktor Prutyanov Message-id: 20240307-elf2dmp-v4-10-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/addrspace.c | 46 +++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/contrib/elf2dmp/addrspace.c b/contrib/elf2dmp/addrspace.c index c995c723ae8..e01860d15b0 100644 --- a/contrib/elf2dmp/addrspace.c +++ b/contrib/elf2dmp/addrspace.c @@ -22,7 +22,7 @@ static struct pa_block *pa_space_find_block(struct pa_space *ps, uint64_t pa) return NULL; } -static uint8_t *pa_space_resolve(struct pa_space *ps, uint64_t pa) +static void *pa_space_resolve(struct pa_space *ps, uint64_t pa) { struct pa_block *block = pa_space_find_block(ps, pa); @@ -33,6 +33,19 @@ static uint8_t *pa_space_resolve(struct pa_space *ps, uint64_t pa) return block->addr + (pa - block->paddr); } +static bool pa_space_read64(struct pa_space *ps, uint64_t pa, uint64_t *value) +{ + uint64_t *resolved = pa_space_resolve(ps, pa); + + if (!resolved) { + return false; + } + + *value = *resolved; + + return true; +} + static void pa_block_align(struct pa_block *b) { uint64_t low_align = ((b->paddr - 1) | ELF2DMP_PAGE_MASK) + 1 - b->paddr; @@ -106,19 +119,20 @@ void va_space_create(struct va_space *vs, struct pa_space *ps, uint64_t dtb) va_space_set_dtb(vs, dtb); } -static uint64_t get_pml4e(struct va_space *vs, uint64_t va) +static bool get_pml4e(struct va_space *vs, uint64_t va, uint64_t *value) { uint64_t pa = (vs->dtb & 0xffffffffff000) | ((va & 0xff8000000000) >> 36); - return *(uint64_t *)pa_space_resolve(vs->ps, pa); + return pa_space_read64(vs->ps, pa, value); } -static uint64_t get_pdpi(struct va_space *vs, uint64_t va, uint64_t pml4e) +static bool get_pdpi(struct va_space *vs, uint64_t va, uint64_t pml4e, + uint64_t *value) { uint64_t pdpte_paddr = (pml4e & 0xffffffffff000) | ((va & 0x7FC0000000) >> 27); - return *(uint64_t *)pa_space_resolve(vs->ps, pdpte_paddr); + return pa_space_read64(vs->ps, pdpte_paddr, value); } static uint64_t pde_index(uint64_t va) @@ -131,11 +145,12 @@ static uint64_t pdba_base(uint64_t pdpe) return pdpe & 0xFFFFFFFFFF000; } -static uint64_t get_pgd(struct va_space *vs, uint64_t va, uint64_t pdpe) +static bool get_pgd(struct va_space *vs, uint64_t va, uint64_t pdpe, + uint64_t *value) { uint64_t pgd_entry = pdba_base(pdpe) + pde_index(va) * 8; - return *(uint64_t *)pa_space_resolve(vs->ps, pgd_entry); + return pa_space_read64(vs->ps, pgd_entry, value); } static uint64_t pte_index(uint64_t va) @@ -148,11 +163,12 @@ static uint64_t ptba_base(uint64_t pde) return pde & 0xFFFFFFFFFF000; } -static uint64_t get_pte(struct va_space *vs, uint64_t va, uint64_t pgd) +static bool get_pte(struct va_space *vs, uint64_t va, uint64_t pgd, + uint64_t *value) { uint64_t pgd_val = ptba_base(pgd) + pte_index(va) * 8; - return *(uint64_t *)pa_space_resolve(vs->ps, pgd_val); + return pa_space_read64(vs->ps, pgd_val, value); } static uint64_t get_paddr(uint64_t va, uint64_t pte) @@ -184,13 +200,11 @@ static uint64_t va_space_va2pa(struct va_space *vs, uint64_t va) { uint64_t pml4e, pdpe, pgd, pte; - pml4e = get_pml4e(vs, va); - if (!is_present(pml4e)) { + if (!get_pml4e(vs, va, &pml4e) || !is_present(pml4e)) { return INVALID_PA; } - pdpe = get_pdpi(vs, va, pml4e); - if (!is_present(pdpe)) { + if (!get_pdpi(vs, va, pml4e, &pdpe) || !is_present(pdpe)) { return INVALID_PA; } @@ -198,8 +212,7 @@ static uint64_t va_space_va2pa(struct va_space *vs, uint64_t va) return get_1GB_paddr(va, pdpe); } - pgd = get_pgd(vs, va, pdpe); - if (!is_present(pgd)) { + if (!get_pgd(vs, va, pdpe, &pgd) || !is_present(pgd)) { return INVALID_PA; } @@ -207,8 +220,7 @@ static uint64_t va_space_va2pa(struct va_space *vs, uint64_t va) return get_2MB_paddr(va, pgd); } - pte = get_pte(vs, va, pgd); - if (!is_present(pte)) { + if (!get_pte(vs, va, pgd, &pte) || !is_present(pte)) { return INVALID_PA; } From patchwork Mon Mar 11 19:12:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779440 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1690925wrt; Mon, 11 Mar 2024 12:24:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUBtIHMR/y6TNI0heBSckf/dsuEZ7wPp2LuB5YjQqwOPipFBoCN5nDB1wGQsNlgPwo8FA0TB6/wx6aWSe/fNGun X-Google-Smtp-Source: AGHT+IHiLnVEYRwgAwX8oZ8/HiFJwMM5siVFx9QhRKbCinNiz/EB97KimoEMKdoMZDyCG+Wr2fjP X-Received: by 2002:a05:6102:31a7:b0:473:37f4:e79 with SMTP id d7-20020a05610231a700b0047337f40e79mr3109643vsh.24.1710185041968; Mon, 11 Mar 2024 12:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710185041; cv=none; d=google.com; s=arc-20160816; b=ldfVzwTlQb3NyCPz1x+9dzEzIspooMCvBMnBBEUua3EiR5S3dZClEoDZdQKOdPN+PS saUw+flUOdBZLAEE/WP23MQVIkOxczxs90kQjNXO9A1tqPseMp1sCTJvj+QTRv6BoYjJ Sy4uzWAYmR2Oz2TgTgefN+AG3jLL8BYop2HTdj8tyXdsisaO0Ck0YEkJK7dmS3wyLdEp OIkEmYWi4sECn1O3YA2DQNLiWHqb6QBUv2NKG3fwVi4BYCJlcRKa+m4NnTyf81uEO3YH skxOI/ix8vTP83uspx2Fk40YWBg0zqKqQ4i5EDZypBV4p8dtGcKulmjqF+HxLcnSHXFa kNQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=9cpC5ONUmKADFIo27SY4dOLo7q+xMFpYIDvQ0gC/LpI=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=GwlrLbF2gqrQ5FQdqvq8FA7K8EphJvYF6aa003DboxNZ6VcQZJ3qlT/8jZf+f2zpxK ND0cU1zw/fFlGAKPT1Xm7IVbSPd8RTlfSiS2/455lqp1vfFPR6Hr/Vzzm9k7a9514Dnf MSjm8M1b5JpD4XXRI6z9KIa3ROrAIe+Kvqdzn5yb+q6pMmwo5bHFgpGUvhgiVDBBsnJG jQUYk4GO8UNAD4NK9leIlxhDzboH8b9w5WaOiSx16X6/idv3hlAVk2SW225sTZOmuAuO Y++CP9eIwi5PXSdXmB2Wc+1RE3Yu8jdc1f2VQ8pZ2Qb49i8JL4V4j7EMO+gakRVFdH78 LWOA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nB6Elw1y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ma16-20020a0562145b1000b0068eda254d98si6009261qvb.29.2024.03.11.12.24.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:24:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nB6Elw1y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl5P-0003ZS-10; Mon, 11 Mar 2024 15:13:23 -0400 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 1rjl4u-0003OC-4V for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:59 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4s-0000Mu-6R for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:51 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4133027fa88so3709195e9.1 for ; Mon, 11 Mar 2024 12:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184368; x=1710789168; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=9cpC5ONUmKADFIo27SY4dOLo7q+xMFpYIDvQ0gC/LpI=; b=nB6Elw1yUAR/a432EzZmxNSWbh5LFnETGOuWQ1wI/NRqv47ZAUn6z0ddafEEQeVBQ+ IpMR1lPobpYqSB5+gCTAsElVHUwkvYL/PFZAaMbjlvkZBcOhEzd+eU6qjOO4pjoic+wB QAL72r8PwHrmUUikLMRfNVD0Utr9pe+qpHJcvQ85+TXsE3Q96+SJCptzzDn0iGLfJjRP biAO78VoXRm2ksvOsrwFmsjbJmD98rgeYd+a4yUFRXbCUga0K/gwFExlDjNPIwyJWdM6 awLkV67AKhaB184vmBs+yhbmjfSPV6/0gM8Fqn4YeUR0XsX7snFTlHCrF7jEVmN7oGa7 V21A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184368; x=1710789168; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9cpC5ONUmKADFIo27SY4dOLo7q+xMFpYIDvQ0gC/LpI=; b=tNj80eVlWHdeHv5mT7umjpqHnYSpnuLiS45njmgdaonwfIoOFIQc29PWL7hhsGTm9v +EYJqexqf8mss1mXadf7cX1qu/d6dhIbraNzgT/27EAZEbApbHkCKXx6zQxjzVxJst0T X3jrc9NTcHp6Ix0XrfwIOTz+wQSIFbfBNDL6pXIwu4hDM+kf9mjnSDSnbZDVamORhD08 wuE+Ruej+UQNVJlzvUsPvl2XBKjmfNTLU839sAr6Hky5E4ZhMIk5EhBCC/BBPcrlacWZ Php31zFcWoz5KZ0KP3Odz2/xFNLitkOkNUA+50e79PY7j94WPBGQ0C920di/jjLvo5g7 7C7g== X-Gm-Message-State: AOJu0YzFrGzlKt1M5DkNp7JW8fYbda340omoNdDOtOFvWEOn+gwh5W97 tWmH2WSvVnvmTLoi88zNw3nt3Zd3CdWeVe2n43gb8tzpLQ/4Nu4iFyDpdOQgxhf+fw8dt7qRHLs 0 X-Received: by 2002:a05:600c:4591:b0:413:2a9c:6ce9 with SMTP id r17-20020a05600c459100b004132a9c6ce9mr1030978wmo.17.1710184368376; Mon, 11 Mar 2024 12:12:48 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:48 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/20] contrib/elf2dmp: Always destroy PA space Date: Mon, 11 Mar 2024 19:12:33 +0000 Message-Id: <20240311191241.4177990-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki Destroy PA space even if paging base couldn't be found, fixing memory leak. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Tested-by: Viktor Prutyanov Message-id: 20240307-elf2dmp-v4-11-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index 9347b0cd5a2..32dc8bac6a3 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -549,7 +549,7 @@ int main(int argc, char *argv[]) va_space_create(&vs, &ps, state->cr[3]); if (!fix_dtb(&vs, &qemu_elf)) { eprintf("Failed to find paging base\n"); - goto out_elf; + goto out_ps; } printf("CPU #0 IDT is at 0x%016"PRIx64"\n", state->idt.base); @@ -634,7 +634,6 @@ out_pdb_file: unlink(PDB_NAME); out_ps: pa_space_destroy(&ps); -out_elf: QEMU_Elf_exit(&qemu_elf); return err; From patchwork Mon Mar 11 19:12:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779428 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1690013wrt; Mon, 11 Mar 2024 12:21:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWnv+WF4dpEbXzVOOzgIky7Cn2viwYgoBRy5qyg7xbIou41rNHagE/moj1ZHzu4wDflqRD3KNyIaBQ3hkXvOLJm X-Google-Smtp-Source: AGHT+IFwZLlGPAUAHLmS9DNAIkMjwH3mnsluL0K2YEXJAcsFC9DFIC1OlWH1UgTwRsVcyg93fehH X-Received: by 2002:a05:6214:808:b0:690:b8d3:97b9 with SMTP id df8-20020a056214080800b00690b8d397b9mr7198977qvb.59.1710184896895; Mon, 11 Mar 2024 12:21:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184896; cv=none; d=google.com; s=arc-20160816; b=BkMaBN6vXlmhw6LEPevj+WUumyTapZbLbIeHYUXLWUO4vx6q+uK+O2qYSp2yMulVS1 /o33yI4DxYlEDsFcx26teP7N1jBAYD2BDnOfKmn0SEmgUtSc+ajk+VbUqEAf+HU+FrHt dyt3ffMfqkg2NcuiDrpEbgs1lUDGztdR6tm4NmWZhxWX30HF6iK4ya44QXbNgN1OxKUN nLRlq0/33vdsNRISDc9I8cMv5JdUqYqO5X+JU7A8kDsXMKpiG6S25KLdSe+5ZinceM/5 QPdCUiJtX5f/z0uAjXAj7yY7+2oFZm6KsDaArzg2YCo7G6K+5OhheGcftCKOdG+JsW3R gG8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=A59mPIOzxW832wrj7lv9qR1xuPqLZ/08WFi3vivBPC8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=fZozor8XqfGg+7XCHErb9JaJlT+kI7636vJFrG5w2ICira8YWU8OCBcKdH2tKlUJCu KVUf8QDjWhMCVJ+veNgaTD4qSScaKaK5RA952BdE8rgxlqqz7BlVfgx6tSdhw4yNH8CB S/nUbRfFRsibwTiuRAxHZFp+82VfuFh4zX9NHko0NQk4mov0gJQZqLIHn3M/jYpTWK1W b7jHgP2jl6ouKpUpK4Vk3wvvUX/ElrG+Ozkeqm3VfPpnKUqB3Ivub8gc9zoUa+mexuw8 tXYpdEEQgneXMIPUXZ6Yti7/6ewD4c6LLi3ENfZ1tQn1/6uKmCF2GyalclYWNbD380zm XR9Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KxxvvvXa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id qp15-20020a056214598f00b0068fdb074d49si6017458qvb.162.2024.03.11.12.21.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:21:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KxxvvvXa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl9x-0007Lg-0g; Mon, 11 Mar 2024 15:18:05 -0400 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 1rjl53-0003PK-2C for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:03 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4u-0000N7-Qs for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:59 -0400 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-5131c48055cso4854512e87.1 for ; Mon, 11 Mar 2024 12:12:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184369; x=1710789169; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=A59mPIOzxW832wrj7lv9qR1xuPqLZ/08WFi3vivBPC8=; b=KxxvvvXaEgfCf69n2HPy1ikFwOA9GWxtlvMwh+bdzolvDUdnf8McL21+I/aJiReaqo 4p0ddrfgDTAFam547eBxZ3X9jv1LZfWEGnbA2Ffrig6Ak47TNxHDtTHKC3UHZFINQT2a xX6rpaOMYrol0Xxga99Hew5Iio0NaKEEazgJ2hdtS7W2BZv2dmyZVAKdE+WdMbnLP6e3 tyNdON9cIZkeL3LAIjXWMOCyOco9JCMuDWHJ1CCradP7pVjGF9Ma6V3cLYezMMvxBN8s sbI8jR9ZIIsLFmyy2GuFuUDdfzCuBGGsFYh13gRlm0lUIe5QCjXLWw/C38xC/PT22uF8 Q5nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184369; x=1710789169; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A59mPIOzxW832wrj7lv9qR1xuPqLZ/08WFi3vivBPC8=; b=gOvwWtHeBBTnaQ3YQhkbPq99jVH7JC6CNzIP92J1oI5OL7t5H445vZbuXiTVO6Fpf4 m+FxJX8ZcJqxuiSPGuinTHs9tTT0Gb+HGi1Xkg7mLGPkjgQeOborxEyh5JdC6Ea0lFP5 4sS6lO7vY6inSgoKXpR8lhfm8ncvyG49DqxPLOReHDEC82TtOiMqhS6HaJ0iVCBiAygF ZV7w5KyFIWIal0mvebyb9BMSmwbWuSPFjj3j75y4i33cqq0PP96Ndlkwa5yrOzZE/vTj VtP3AxuM+LNMw8w4BMukLuuLmoW/rvmd/4AwxfuKtAUjgaBLS/AZ1h1LuD2WA2E4Zgy3 QoEQ== X-Gm-Message-State: AOJu0Yw5Dmmu/QQkNVW9AnWpNoJ51KEyatxvX0thxYexafN9tMyDvTTn 1hpOI+XRfST6kLnX5RtTozXEUFNvMKIXQBu/exJxBvxxQU1ZMxaTCr2iSNgZ2YQCKbh/9AB9Iex 4 X-Received: by 2002:a19:3855:0:b0:513:506:219d with SMTP id d21-20020a193855000000b005130506219dmr4371888lfj.49.1710184368783; Mon, 11 Mar 2024 12:12:48 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:48 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/20] contrib/elf2dmp: Ensure segment fits in file Date: Mon, 11 Mar 2024 19:12:34 +0000 Message-Id: <20240311191241.4177990-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x12e.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki This makes elf2dmp more robust against corrupted inputs. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Tested-by: Viktor Prutyanov Message-id: 20240307-elf2dmp-v4-12-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/addrspace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/elf2dmp/addrspace.c b/contrib/elf2dmp/addrspace.c index e01860d15b0..81295a11534 100644 --- a/contrib/elf2dmp/addrspace.c +++ b/contrib/elf2dmp/addrspace.c @@ -88,11 +88,12 @@ void pa_space_create(struct pa_space *ps, QEMU_Elf *qemu_elf) ps->block = g_new(struct pa_block, ps->block_nr); for (i = 0; i < phdr_nr; i++) { - if (phdr[i].p_type == PT_LOAD) { + if (phdr[i].p_type == PT_LOAD && phdr[i].p_offset < qemu_elf->size) { ps->block[block_i] = (struct pa_block) { .addr = (uint8_t *)qemu_elf->map + phdr[i].p_offset, .paddr = phdr[i].p_paddr, - .size = phdr[i].p_filesz, + .size = MIN(phdr[i].p_filesz, + qemu_elf->size - phdr[i].p_offset), }; pa_block_align(&ps->block[block_i]); block_i = ps->block[block_i].size ? (block_i + 1) : block_i; From patchwork Mon Mar 11 19:12:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779427 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1689921wrt; Mon, 11 Mar 2024 12:21:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWip2H0qf5wDWUudewBpWU+erSfCpkpZOolyzQGkDiOno3X+kF2Fnz9SH1pTAnLlSl+Legu2QJ/LiAcHUc5/dx+ X-Google-Smtp-Source: AGHT+IGcOfEx7iuOIzkMbjkvpGwRyJ0AjW/23tTP5NCjomDc01L4cI+9icCu9vc2q3e/cLEPg4xH X-Received: by 2002:a05:622a:245:b0:42e:ed9a:5d6a with SMTP id c5-20020a05622a024500b0042eed9a5d6amr9395067qtx.16.1710184881265; Mon, 11 Mar 2024 12:21:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184881; cv=none; d=google.com; s=arc-20160816; b=iWFEwZsQ1X+jk7j/Dt7YxR1oK3NBW7BlMiyXSO4RRejlKwwY4761HLDXYU67o5N/dk fQLCzrw1FKNJE8r4h7wrPduMXuczpK7v1hW0h+RHgI1ySAgEv7guPPQ7IHAmLdXqxa9+ ErXyjVcx8v+djT4I3dC6puSzDK+Geiz458frawPtyOY3hGgiCFIhas0LpLEla9xt3i7z +SIPMHVyMhtrhFG9GCsTzKiZbN18+xIoU4K2SwJGzGAu8i2KXWT6uf1xnrZp2g/7XO0/ 5nMwkVd1I2BrCNi2452hKyjYpn8Z9tk6q2X9hbZ4/8rwnUruh0LZ1uX8UKDg+wJvpCDH yeUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=1PPP7DyUJzXO4PyrnSnzaFZyN1tK2CNOu4AL56ymsAo=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=XFWL6L/VD/vyhJ9V2QMqchqcvd3WeYdw8j9LLFvGQLIXaJqDvxtuyRTYMnZ1Rr0+bw OtzseHUei573Au/1kOqDHb1cn5DzZ7Tfyk41/javjXn/6muYS/Rh6t1Y/zVVeKDwM8Jm U1AXOkqEHTHcCcMnu26VbaTamk0pJp++YxCG7G1WsEhNCmTxftc1lwN3jVM0upITd7dC WaqlUxWapq0dE94gVX7MZv6uvyaftSM7SSzSxwKlZY/Rwn1LoSpKUTNU1G979fDpgHPN cPwyrNFLdfQEGRkHJDgKW/0N0RztOWvEOsncdaXHFpQuKubop73kAZrrEhtrH3Bt2DHA aWMA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HDTqPu9o; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p16-20020a05622a00d000b0042f213973a5si6065658qtw.318.2024.03.11.12.21.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:21:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HDTqPu9o; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl9o-0006rf-9x; Mon, 11 Mar 2024 15:17:56 -0400 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 1rjl50-0003OV-6x for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:02 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4u-0000ND-QH for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:54 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-41312232c7aso24406005e9.0 for ; Mon, 11 Mar 2024 12:12:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184369; x=1710789169; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=1PPP7DyUJzXO4PyrnSnzaFZyN1tK2CNOu4AL56ymsAo=; b=HDTqPu9ovDVjIGpoeSYbnvY6g98dg07KWVRKs/iaLxEB7yCOYHfzjyCmAhDFW33J/b FXC7ZnofxnsBtQ+PbbQHDvfZS+OY1abhZwIzPlgamYI6P6o+cqJsg38FHZbuOXFWqnGM 3tZZFORt/0f50zyssS2VxT5dzJQUixSk1STuKGIYdTLBrXOvniQ1VX/hqLUQaYbBZzGj 1OqSVsugZEeGPjvmNaEdVArVmMQNU/0AKZFjWFdWZ0AkXdELOakxy25UCSAjXpi0/491 zg8oTgASWTSXFU8pKlLfSqkuE1FSNQeN9DbidRmiAY+1OPlgesD1+jG/T/vWvJzobeyc zIaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184369; x=1710789169; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1PPP7DyUJzXO4PyrnSnzaFZyN1tK2CNOu4AL56ymsAo=; b=bNIM+VkJ52+Base+AvKuZjWV9RMO56r418xanu3/Q11AtUjDozeoWFipGa+Cd/maIk cEEap2sHOcKSAwWKPSHgHyectTstQcHQNOPk84nMGRHP12whbiZkf+IIw+RH0nXh45RY Tl+kKwgL5U47maxcVCI9X67rkMAbCdoU103JWd2KMhcouonJBjz2wDBfjxoy9iY8F3Xn ZSV0Nxg2hnRYQCtNLNZfxnEm0hSQ7ut2O3fsVaVzIBClEgJ1jJWVSzmjJIGlJ4KXjv6e ZPdEWO4SyHjFNdEpTG+h/ExGuui1b8htdH6jhA6rsu3f/Kw4wnqICf9bnmNtjqZIeQpK /m1g== X-Gm-Message-State: AOJu0YzYBr5yEEfYy0SkYFwrIpbwK48SJc0U5KkGoGmn0XrzDaxwzqRZ XSITPna5dWN+6pgzriUgSQ9QMiifU03F2IznFVD46zN0Lclgn+Y14ba8S+YFeQfNlQEmMOn1P9t 4 X-Received: by 2002:a05:600c:4f50:b0:412:ee33:db93 with SMTP id m16-20020a05600c4f5000b00412ee33db93mr7013109wmq.3.1710184369331; Mon, 11 Mar 2024 12:12:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/20] contrib/elf2dmp: Use lduw_le_p() to read PDB Date: Mon, 11 Mar 2024 19:12:35 +0000 Message-Id: <20240311191241.4177990-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki The relevant value may be unaligned and is little-endian. Signed-off-by: Akihiko Odaki Tested-by: Viktor Prutyanov Reviewed-by: Philippe Mathieu-Daudé Message-id: 20240307-elf2dmp-v4-13-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/pdb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c index 1c505142518..492aca4434c 100644 --- a/contrib/elf2dmp/pdb.c +++ b/contrib/elf2dmp/pdb.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qemu/bswap.h" #include "pdb.h" #include "err.h" @@ -186,7 +187,7 @@ static bool pdb_init_symbols(struct pdb_reader *r) r->symbols = symbols; - r->segments = *(uint16_t *)((const char *)symbols + sizeof(PDB_SYMBOLS) + + r->segments = lduw_le_p((const char *)symbols + sizeof(PDB_SYMBOLS) + symbols->module_size + symbols->offset_size + symbols->hash_size + symbols->srcmodule_size + symbols->pdbimport_size + symbols->unknown2_size + From patchwork Mon Mar 11 19:12:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779425 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1689645wrt; Mon, 11 Mar 2024 12:20:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXXfvpVuC5/bBjBehnJWZUfB3Va09jmkusxS75rdUrzlhZsPB1NQq3GTEVM07J8tPcZk7aE0OK6yeIAK+E37Kwv X-Google-Smtp-Source: AGHT+IF3FZ0juF7QNEyLXkyxFo2dBtVeF0qY8ItYI/aT99QOHlM0ODelntLpm/Nz/avQgXe7g17i X-Received: by 2002:a05:620a:44d6:b0:788:2357:604e with SMTP id y22-20020a05620a44d600b007882357604emr15323971qkp.3.1710184835036; Mon, 11 Mar 2024 12:20:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184835; cv=none; d=google.com; s=arc-20160816; b=Y+1sPjFmood6RDlQu9XokFbhCAdOxI23TeGYmuz66BXoRv+Aa3gztuosjFhjUASP7h Hi0nlF6U5C4dLspCCUsWDTEPeHC39ujn9WwXwEyc6l4M9LZOnEskdaC4KBDQrR3nxXZ4 2Z/7R25AYdeC6h5JjjFopwUYNN2BH5C9ulNBZ28xia3lxrnRjD+QfXo7GQ8NhRVgLVlx bTaLoiNb1WdveW20+4CcHPhdP6lX52crYYeZhAPs01cuT09FmclSYetd5keVu+8z8zTl HZ+6G9Ht3JrEmbvqmTQHpKJduMIejDVqro5LE/IDflIHh9SwRNl985D/bmNMfiboJFkr XN9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=xdS6BQ4zGUSaBLNVAflAeEIqw3hx2MqgTFA3HutXwAc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=xM/G+1EbTkN5ttnJccYzAD1afgs3trVUnoaOn5N6w31lMRMQNxt7Ms9lpp+HX5fssc 7XhRbWrtIkG83BlRbAYGGiCTqm1NJrBC8VPeOduQLGDJ2nKcL7Hzruc0bN+0oGwYx4YF /alImLCZURCBVZnlV72WvUwHFnE/BnoElHPOiwrooJ0mIMdWWzuoYvLrUMlDJIfbPKjM mQC6oCaFL61BmEhRn1TkNcADO5cbfCotDKokJIO+kSCb3qWa9UochATFA6jELuDnoCTb Uq0ZSKHojp40j5Y9kLxYyxA7y9KmJCbyrYKPDdHtZU4iBizf9Z4xkBhmcSzWXw93xsq/ mpQg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Bk9RdLGq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h13-20020a05620a10ad00b00783577b7501si5962647qkk.357.2024.03.11.12.20.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:20:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Bk9RdLGq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl6k-0004j7-Tf; Mon, 11 Mar 2024 15:14:51 -0400 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 1rjl4w-0003OP-OF for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:02 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4u-0000NG-30 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:53 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-41332865abfso401455e9.2 for ; Mon, 11 Mar 2024 12:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184369; x=1710789169; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xdS6BQ4zGUSaBLNVAflAeEIqw3hx2MqgTFA3HutXwAc=; b=Bk9RdLGqNjvuwE5QOLlO7CTtzqxxhcBDPVnFcjRR8UnwOPKOkiv2nehlyIZTuenP6N XSJ2Lf8zhJztfk/C1lzQjRL7Zqmumqm1Cn/0WFBxa5ShExlMQ9uTP240jGDFC5aoqlIG 6Sad2Uhbdkk/MAh0KE4zVgxbekCc5ulG8LkZRpSFK/2RpcvIvhbZWuwkRh4MZyaFJhA0 LGuYRWW+YOUOIc0HfJO4xega5IJAHYOemwXzNPhcgiNGQFLfzuOKfVjwg60AfnL9SSdG Vq6+0f4JiBPbtvjdmYA7oN2h4jkyXYg3Fou+KRoYPMSnhX3YL0HEKhCK3IuM5ox0Uu5k iFog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184369; x=1710789169; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xdS6BQ4zGUSaBLNVAflAeEIqw3hx2MqgTFA3HutXwAc=; b=deYfCLABo+acZTRUWKXRxFoGHEEO+ImCHMfquhEzSmPOQQo3mp56WZwW1b+i/izNbh 6wYCnNLsL4/gMucyNvIzTz34kpj39sv5f/AiMdItw22bQCfGNfNzeZK9LDTG6FiYJzo5 6x6y6h0PGwOARoL+J+7ITq+SCPoj878/0YKazi3R0Yc/ANM/Kxefo6MZ2mKXspfDPZPb Tyh2RndcXZqv8iaCqkpHOYvURaZB5YM1zt4lUum/L5QvBS4wQG7igmPX2p0wPYP4Ki0R BSFjxU9b6Uo+TS3Taou08gBs6LWo/VjWmylHjhaKcFS6DHxYVgkjZZM26uQV04JvAUoB kSdw== X-Gm-Message-State: AOJu0Yys7jufSwSh2cSSDQ3bf6VzkfNpVqDsCClCstTYf2NxMVXFSZB5 +Tutq2ASsobmEeAW8m9pt1k2J9w/Jnt7vRAE5JWHBlnokDh6ke1Qr2l4xIGtIKT4oQhP9Bp5omU n X-Received: by 2002:a05:600c:1990:b0:413:21ea:968e with SMTP id t16-20020a05600c199000b0041321ea968emr5900386wmq.41.1710184369667; Mon, 11 Mar 2024 12:12:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/20] contrib/elf2dmp: Use rol64() to decode Date: Mon, 11 Mar 2024 19:12:36 +0000 Message-Id: <20240311191241.4177990-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki rol64() is roubust against too large shift values and fixes UBSan warnings. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Tested-by: Viktor Prutyanov Reviewed-by: Philippe Mathieu-Daudé Message-id: 20240307-elf2dmp-v4-14-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/main.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index 32dc8bac6a3..d046a72ae67 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -6,6 +6,7 @@ */ #include "qemu/osdep.h" +#include "qemu/bitops.h" #include "err.h" #include "addrspace.h" @@ -47,11 +48,6 @@ static const uint64_t SharedUserData = 0xfffff78000000000; s ? printf(#s" = 0x%016"PRIx64"\n", s) :\ eprintf("Failed to resolve "#s"\n"), s) -static uint64_t rol(uint64_t x, uint64_t y) -{ - return (x << y) | (x >> (64 - y)); -} - /* * Decoding algorithm can be found in Volatility project */ @@ -64,7 +60,7 @@ static void kdbg_decode(uint64_t *dst, uint64_t *src, size_t size, uint64_t block; block = src[i]; - block = rol(block ^ kwn, (uint8_t)kwn); + block = rol64(block ^ kwn, kwn); block = __builtin_bswap64(block ^ kdbe) ^ kwa; dst[i] = block; } From patchwork Mon Mar 11 19:12:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779439 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1690827wrt; Mon, 11 Mar 2024 12:23:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVc5hDaxTKVEW5ofk2t8UjF7jgiSOjkSXecm0W6HgGZXrnaqc1u3HpL5IqNpWWclojZzs/wkSPVMFRKdiwGA73I X-Google-Smtp-Source: AGHT+IGn3FbT0tybwBmJyqd9s7mrgahgfbRFNl1KxG4dKxHs7926FH5PR8qs0JSvBO9bT9Bhkok4 X-Received: by 2002:a05:622a:54b:b0:42e:f5dd:99e1 with SMTP id m11-20020a05622a054b00b0042ef5dd99e1mr11569168qtx.1.1710185025888; Mon, 11 Mar 2024 12:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710185025; cv=none; d=google.com; s=arc-20160816; b=Y21QXc32Z2DXYnjMidZA9DYWWYseylVEn67yDM2EAQWgyXvu5LG6bqtii+qV2GTSov h2+zN+U4jNJlm3dtqfnx+iNcDGAxGBxtDL8xz79052orkIx2RpikAdKtYnXgXze+7pnz WKIvHjBYoFYSs8YOsAnioPzPJ3VdXG81uKbnNfhttsGngYo7WuaBPQRhP7NLcE01RzMf 1RfBf09IsOLAMDx43gf+UUNfSe0OkygLMpsrIQLudvWxbKVMlm2d/olq58g6aKBlSkGZ 9ON7wv6jRHDkE33hPCkZwk+xL6/HgkQo4kOivnCBZ01SChDzZoINo+snxQdQH5/ezzFE OtbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=UgMQNZZ+dnFwwntXyAYCnlpzqcj4xoDYfMT2WTZkqy0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=XF/e/7Gkr4e2U9zh/IHc6iThxKZBM/7MNyBla8gTbXOZq2uBdUbQFJTDHQEBBjFox5 pv7TZ8xebsFfKrAGoncyBeq26aEPOBUgZJEtR5mQ2yrsVdx7omU0YvPazZVpp25iZ/L7 itIbxe8ZF1TR1laCganyetilqVQydAWATsH130VLOujpvpzSiZ7CIHZNf4e8b4ey7wKc SeqhClgv3AqGnS+wSe/A4P4iMQWifEq1gEhHk6og2kDsQJHscAAs5VDNpwkYgS/mxO1s s7OaNcLN07Ej5fnCnwKtEbqI8M8avUTD2ZRhInPkoer0iUq9kZAKH8xKX3PRwH98QHWp NJDw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b1SeFyiO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w14-20020a05622a190e00b0042ee033d68esi6107733qtc.581.2024.03.11.12.23.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:23:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b1SeFyiO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl7I-0005G7-Uh; Mon, 11 Mar 2024 15:15:25 -0400 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 1rjl53-0003PH-2T for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:03 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4x-0000NW-4n for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:58 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4133100bccdso2012385e9.0 for ; Mon, 11 Mar 2024 12:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184370; x=1710789170; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=UgMQNZZ+dnFwwntXyAYCnlpzqcj4xoDYfMT2WTZkqy0=; b=b1SeFyiOSLFlP4dYJYXd26n4OMnm9OfeKp1BAkwvsHfJKy/2kmN/eGio+0KVnFw/A2 wKyVHnEjIFQTEH1a8h3GBBKpgg+W1TBkr0dNZvePo4yOvrSshTKb7O8wHgVGTnUF1jJ6 F7j0cBX4jYAd6t6QQEHtCooIxZf3TH1WSgPHnLDnCCpAhTMz65rLjLDiGplkWnzcPwyE i6K7gHLLMQ0jy8LJdqPKHK0sBYybC3kMJTCjIptpb7eSWXtSFGxpO8LKt6dTNMLGHSOa tsOcVhjuspFJp6N9zDd5lO/Y9kY7RxjdiyQOQ2ElQSuQg+rxSptfO57+cn1rk5LX2s/R MrYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184370; x=1710789170; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UgMQNZZ+dnFwwntXyAYCnlpzqcj4xoDYfMT2WTZkqy0=; b=DrGBwZod2R+REdgyn8Cu9Lttbc9ldbvlB6m9XsvcK0I1CHHWCDjNWEBe6fOPk1xktd CRVnTiKw0FQkz0mMyOQ9rSayDTky9l/xIh05/+MtUmrYQAvCz6F3XwYJSh8d8MIDy79Z TECdFuw14eGMlhhfBtwub7VxwTSz8rmU8EXtuHN8v4S96Qksy2nivQXzKCpJrc5EpLAm 2AAleCE2zyRdzHLdHR+B9Vb1Eh/RR8TEXVIX/0M3by/rVqBtI671Y1zSHvMRAthAr/Rf g6Zg0ihczx5YJhAr/ZgF8slTJLlpWsFuX4o5ejEl/jUW4cdrYj1wrBeynRw+qQ4KkL4A 3txA== X-Gm-Message-State: AOJu0YzybPxUcUbwLlU2SUOlPF8G2NAynDIEz6dPorAdRXyaoWfC54GC h3aFylsbv+NquhS3Ow4X8Vb8Im4wlB+zK8JhSArxbcMKWcmRoxKpYRHLfYUtxC5+kETlMqo+Wgk U X-Received: by 2002:a05:600c:3513:b0:413:1741:289f with SMTP id h19-20020a05600c351300b004131741289fmr6240226wmq.5.1710184370051; Mon, 11 Mar 2024 12:12:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/20] MAINTAINERS: Add Akihiko Odaki as a elf2dmp reviewer Date: Mon, 11 Mar 2024 19:12:37 +0000 Message-Id: <20240311191241.4177990-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Tested-by: Viktor Prutyanov Reviewed-by: Viktor Prutyanov Reviewed-by: Philippe Mathieu-Daudé Message-id: 20240307-elf2dmp-v4-15-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 4d96f855de5..12f5e47a11f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3587,6 +3587,7 @@ F: util/iova-tree.c elf2dmp M: Viktor Prutyanov +R: Akihiko Odaki S: Maintained F: contrib/elf2dmp/ From patchwork Mon Mar 11 19:12:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779434 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1690310wrt; Mon, 11 Mar 2024 12:22:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXqBy8UW+Gr+I/RJFQdh3oKYMMZXMOdCQaS60FuTpevbkrHRG4ENgULfqITD1IPvo0AfiOsvRLUx3ieGV8ah9KJ X-Google-Smtp-Source: AGHT+IEfOTD2W6k0Ulk2F7Gv7pEUQGTQirZSuWl/J9fgpOD6pijOKOrSpbGryShbF1s2JXYoZpqx X-Received: by 2002:ac8:5a91:0:b0:42e:ae64:396d with SMTP id c17-20020ac85a91000000b0042eae64396dmr9221773qtc.53.1710184937985; Mon, 11 Mar 2024 12:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184937; cv=none; d=google.com; s=arc-20160816; b=rdc64gHgjshcpfbS/YksweEOGNDzhHhIVQRiVPBfuJK02XZJjFy406j99CBe4X1JWE E+teKe1KqOt15qPnLykEXPZgQ07+s3NzABdYZP8vyc33tsgQUAbsUoPHPw1TxoS/BEAs IIabxxn1m8kxv2wOrWZzsOLDbwHRXiJZtg8klSu4SCAMSdXbP3WC06uCnSmz7DkcoY1n 5QLci+hauathITD9Ly/0wRSSo6I1n1zFW7dokU0+iXDYFCJPur9YNYytkg7iqEKYQ4mK iwbuETel70wXYy1gQx3J9mmuSq+nN0ESRRbWlJADZPZIWDHz5h63VTECuKjEwntknFQu IJgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=SGZNrXP3eEMFAkYdDHaYkmUoBTYEXbgmFV3euRom/N8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=q7d2/c7hlW88HDtxRWXWDIkXd+yXUdmJlqNgV5mVeHGIhBzTHBW4yh+i/uWl3kvFJC BrgeQpwNVWgPHiORBpuq8hLTeUSd09rO1qMZfAbRuelJPVOkTzsFhQOkY7eUfqhBYlnv rfTF4yo7rW5VeHkFVFV5RuO7Ty73A/YTIY8t0BrkRMG3nqwgGHFd8WAWRU2eFsjtfh4k cMXcdx2f3aMPX6xkiftzriE9ut4pa+L9a364IETfpohcZARb+AqM1Sefn+IHSOkyC6Q8 7hOKwlcR8A8CQUMZ6MH1enpGIU7gzJWqx8a76RmaK7LtRQd9llk4Ip4cko/6w2J8YKWE tN9g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hVfqPziU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i2-20020ac85c02000000b0042ef2dcf970si6190201qti.298.2024.03.11.12.22.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:22:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hVfqPziU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl9u-0007Hu-G9; Mon, 11 Mar 2024 15:18:02 -0400 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 1rjl4x-0003OQ-HW for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:02 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4u-0000Ni-JF for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:55 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-513b1c69cb8so888985e87.1 for ; Mon, 11 Mar 2024 12:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184371; x=1710789171; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=SGZNrXP3eEMFAkYdDHaYkmUoBTYEXbgmFV3euRom/N8=; b=hVfqPziUAcHozo5wQjpWEcWYwT++u4PW7yHk8pqx4Lf/wtPSWYjkePAhC1tCm1NBkU lHXk4yeFDuc6hGKcMtXG59kROP7y80dCE9lL2njUfnAXNIAJ9vcy4PAH8LAKnaHVbYKH CpKafzs68YhRg15jfXzc8yloUFlo7MEzXGKWYaSML7WGxIdAjhHa8BxtHe8+vNKh03MM Ox+2pJtw8NHUMCyar1/d7lOZKgq4NzirdOA06+cuowxlt8ymQsabwIG2fGiKLAGqeuzZ jmQPTykgzuBC0q6E5ZfDMuVBFwJ2pEWzDejPKkL86U9qwK7YHwrEd0j1Sb9POZ344zZb us8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184371; x=1710789171; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SGZNrXP3eEMFAkYdDHaYkmUoBTYEXbgmFV3euRom/N8=; b=d9NYcVgkSpMIhX8prm3XYnMfQLv58T2w29STQVkhsVpCBB1RxuhCBi0T0IyEF4/KpP XlBa5QWH42lEntSF51y+oihepFmcTUXWFrVRxB7/EXhQjci/e3BmR/9AoiGzoPO+mxkr Ws6ysSdQlW59PMoQRt5wxBM4CL7O2YAqgB+8Qz4DU5F0WNxslLAl/7E9JbHR9u7I9akq /3PuPS5QKORbwlDpUyttiZ95xL/16oTIweNlHWXww1Af4m+MAyyvL6tYLTpTuimZ52gi MvH4RgY/vDYNalvFgVre0xrAzrJhUIrWmt0C5Hw/bez5SG+OctBLcHqmK98gaP2Unybn ichQ== X-Gm-Message-State: AOJu0YxI4eagGO6Fi8q6ravFd2GfGLf4U1R+25gkYoymnVVVZVS3fGKf OmpmaxJW2Bl1upzS36CS1stLt+PqX56O7lEVQxqGR9Kmyph7ZnRB6Dd9YqdJydzYBM1gPLxY9cI y X-Received: by 2002:ac2:5a09:0:b0:513:45b7:91c2 with SMTP id q9-20020ac25a09000000b0051345b791c2mr4405200lfn.36.1710184370636; Mon, 11 Mar 2024 12:12:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:50 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/20] contrib/elf2dmp: Use GPtrArray Date: Mon, 11 Mar 2024 19:12:38 +0000 Message-Id: <20240311191241.4177990-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=peter.maydell@linaro.org; helo=mail-lf1-x12b.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki This removes the need to enumarate QEMUCPUState twice and saves code. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Tested-by: Viktor Prutyanov Message-id: 20240307-elf2dmp-v4-17-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/qemu_elf.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/contrib/elf2dmp/qemu_elf.c b/contrib/elf2dmp/qemu_elf.c index a22c057d3ec..7d896cac5b1 100644 --- a/contrib/elf2dmp/qemu_elf.c +++ b/contrib/elf2dmp/qemu_elf.c @@ -66,7 +66,7 @@ static bool init_states(QEMU_Elf *qe) Elf64_Nhdr *start = (void *)((uint8_t *)qe->map + phdr[0].p_offset); Elf64_Nhdr *end = (void *)((uint8_t *)start + phdr[0].p_memsz); Elf64_Nhdr *nhdr; - size_t cpu_nr = 0; + GPtrArray *states; if (phdr[0].p_type != PT_NOTE) { eprintf("Failed to find PT_NOTE\n"); @@ -74,38 +74,29 @@ static bool init_states(QEMU_Elf *qe) } qe->has_kernel_gs_base = 1; + states = g_ptr_array_new(); for (nhdr = start; nhdr < end; nhdr = nhdr_get_next(nhdr)) { if (!strcmp(nhdr_get_name(nhdr), QEMU_NOTE_NAME)) { QEMUCPUState *state = nhdr_get_desc(nhdr); if (state->size < sizeof(*state)) { - eprintf("CPU #%zu: QEMU CPU state size %u doesn't match\n", - cpu_nr, state->size); + eprintf("CPU #%u: QEMU CPU state size %u doesn't match\n", + states->len, state->size); /* * We assume either every QEMU CPU state has KERNEL_GS_BASE or * no one has. */ qe->has_kernel_gs_base = 0; } - cpu_nr++; + g_ptr_array_add(states, state); } } - printf("%zu CPU states has been found\n", cpu_nr); + printf("%u CPU states has been found\n", states->len); - qe->state = g_new(QEMUCPUState*, cpu_nr); - - cpu_nr = 0; - - for (nhdr = start; nhdr < end; nhdr = nhdr_get_next(nhdr)) { - if (!strcmp(nhdr_get_name(nhdr), QEMU_NOTE_NAME)) { - qe->state[cpu_nr] = nhdr_get_desc(nhdr); - cpu_nr++; - } - } - - qe->state_nr = cpu_nr; + qe->state_nr = states->len; + qe->state = (void *)g_ptr_array_free(states, FALSE); return true; } From patchwork Mon Mar 11 19:12:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779437 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1690527wrt; Mon, 11 Mar 2024 12:22:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUS5OopgWLekwIT9q4iPDiinE8mda3ord3Fi5GTVco57/qFhgMhZFV/spuSGy3+pvgH/yhgqjVZasUtxGPq5v6B X-Google-Smtp-Source: AGHT+IGkNSXVvbl2U5C6VXeg2PCdZtWGWz3G/hrqAUgl7H+YMNbzqZGJ+yYY18th+8Zmx+RlFD2C X-Received: by 2002:a05:6808:1294:b0:3c2:370b:2fff with SMTP id a20-20020a056808129400b003c2370b2fffmr8820126oiw.46.1710184977532; Mon, 11 Mar 2024 12:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184977; cv=none; d=google.com; s=arc-20160816; b=gJHclL1iqTp3BGggM0U+3h8Wco4eVfdz4KbY1o5uRkA8o3zWUUUU87NrN2bodaJV+W BLTMXkyZ7kFfyYLsxRfw65cCLJDfervyg/rJTorneUaDWHCTEgS1sNE63iQ/uqmYCs2C pIqMM8J1gTjUxSSjNk2HI+AyanygQUMDjZoI3T3HO+U5ITuP1f4QwAKEnzZ/ygQpnWax WH85f2qw1i7xzfAD2DcdsVnlvjur60tIfLkT8HPmu9xCkOJdSAipYp880szwFvw1JJrd CL57WEOhnxt0rrYvm6ZWjY19b4v2jxk4xo6w3WsPh0VN+NV54XC7lKhtMX7DG8AFZzjF U7dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=sD6QWErgcpioeXWdrsT2adMymrvCNHI9GMAxmhteL7o=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=cB5lEKt4EOff8zRr1lrZYUpenJXawqfqCIGhHfeSdD+7K34QBV3sPcifuUwl1rAbU3 z3f6ClSOLzLRzVKXIJ+Yi5N95iWS3ghxdBYlnDe1Yc3PaXK3NwMVdcrbpUd1ChpbXSQ3 56sF+3sQ2leuz/bFIPlvSH1ue6WuiA4sGFiXSSpTwQoWw9fE9RTcz3pEAIi+R2JIkh8t 7usrPMxW9zbqglih/bqM331tGvq52eml0UsH3dKV0TYgHflFnI0yjH9rqH7rZoiD94FW Kk7C1smlywx+d3sM0vSPs/OQtQrghWpTmn5MCOHCn+tclGHbKurWsaCOuY/YAQ78Azs0 4kkg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y79PSPf6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h12-20020ac85e0c000000b0042f04df4374si6073206qtx.749.2024.03.11.12.22.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:22:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y79PSPf6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl6d-0004f1-DH; Mon, 11 Mar 2024 15:14:40 -0400 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 1rjl53-0003PG-1d for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:02 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4w-0000Nj-Bg for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:12:57 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4132cbe26a9so6186415e9.0 for ; Mon, 11 Mar 2024 12:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184371; x=1710789171; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=sD6QWErgcpioeXWdrsT2adMymrvCNHI9GMAxmhteL7o=; b=y79PSPf6d6Ez0nbCDXw6So2eXrzGAZmyCc3NodLZ9Xwg9lS/Px/vvqqwdweWoOmKnh lXdCqtDRzNMWd9rscFmH2zO/bNU5qqaF2PObA7n9v8IUd6RypqHj9rJRaLfIbJbjY5h8 E7kDb2sfDic2m373CqxLd0836IJgp/r/L/cMo6SFaCRMIzR6nEFpUZVNJp7eSA7nnVNl fEdAJ8Gdcwn9MQ9T6PVyHDZwK90B97WmKpVd9HV7WfxTPgMipwWq1ynDr4CuxXUW1Owo KpdSlQRF2vxYc1ucFsE6vYbOBya9SdcfLBLdyrxIPmjMb546yJJ1SL+aU4x/VPnBHsY+ 14iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184371; x=1710789171; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sD6QWErgcpioeXWdrsT2adMymrvCNHI9GMAxmhteL7o=; b=KXgDvH11N31sSniYlR6fMGXDBgKFvhyYcDJwyQxBGVNL3KJF7P73zBuqyDgWdR5NP/ 1lMJ3kAPmzQdiCUz5O+dUtyY41ciZWBtxvDiwN8Ph+PmDLWwd/cOrkd0VE/qmCD7Mb5w JIZT/YbCtQcvkf1QIZwXAKbjXyDOm6tu9NT3GAhDLK3BY1JrBk2gEuS3iGjA4+Gnc4y7 RS8ie778sYuQAU5TOArQfCn55ouk/3Wu+cUE6hgtu6V3+WCjTCkbVR+qyX5p01yC6OZ0 POKOBID6mwUQc7PeUGU58lIl19nGvXYbPXYYAM9O/6KLgtwhhNQvgnuZK/8DYTAGN06S de+w== X-Gm-Message-State: AOJu0YzvQeleEle1osYDI6lioc4WbPlzZeuFCWD2oNk7N/VETHLdUddE PqotU4YU7ArBN3gKQKRG5m9qULwNk/mMfbiAABs/OvdXuxhqg9lMOWbtJieZd6IV4222dF8vdv0 D X-Received: by 2002:a05:600c:3492:b0:413:2bcf:df81 with SMTP id a18-20020a05600c349200b004132bcfdf81mr2008103wmq.1.1710184371097; Mon, 11 Mar 2024 12:12:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:50 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/20] contrib/elf2dmp: Clamp QEMU note to file size Date: Mon, 11 Mar 2024 19:12:39 +0000 Message-Id: <20240311191241.4177990-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki This fixes crashes with truncated dumps. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Tested-by: Viktor Prutyanov Message-id: 20240307-elf2dmp-v4-18-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/qemu_elf.c | 87 ++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 32 deletions(-) diff --git a/contrib/elf2dmp/qemu_elf.c b/contrib/elf2dmp/qemu_elf.c index 7d896cac5b1..8d750adf904 100644 --- a/contrib/elf2dmp/qemu_elf.c +++ b/contrib/elf2dmp/qemu_elf.c @@ -6,6 +6,7 @@ */ #include "qemu/osdep.h" +#include "qemu/host-utils.h" #include "err.h" #include "qemu_elf.h" @@ -15,36 +16,11 @@ #define ROUND_UP(n, d) (((n) + (d) - 1) & -(0 ? (n) : (d))) #endif -#ifndef DIV_ROUND_UP -#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) -#endif - -#define ELF_NOTE_SIZE(hdr_size, name_size, desc_size) \ - ((DIV_ROUND_UP((hdr_size), 4) + \ - DIV_ROUND_UP((name_size), 4) + \ - DIV_ROUND_UP((desc_size), 4)) * 4) - int is_system(QEMUCPUState *s) { return s->gs.base >> 63; } -static char *nhdr_get_name(Elf64_Nhdr *nhdr) -{ - return (char *)nhdr + ROUND_UP(sizeof(*nhdr), 4); -} - -static void *nhdr_get_desc(Elf64_Nhdr *nhdr) -{ - return nhdr_get_name(nhdr) + ROUND_UP(nhdr->n_namesz, 4); -} - -static Elf64_Nhdr *nhdr_get_next(Elf64_Nhdr *nhdr) -{ - return (void *)((uint8_t *)nhdr + ELF_NOTE_SIZE(sizeof(*nhdr), - nhdr->n_namesz, nhdr->n_descsz)); -} - Elf64_Phdr *elf64_getphdr(void *map) { Elf64_Ehdr *ehdr = map; @@ -60,13 +36,35 @@ Elf64_Half elf_getphdrnum(void *map) return ehdr->e_phnum; } +static bool advance_note_offset(uint64_t *offsetp, uint64_t size, uint64_t end) +{ + uint64_t offset = *offsetp; + + if (uadd64_overflow(offset, size, &offset) || offset > UINT64_MAX - 3) { + return false; + } + + offset = ROUND_UP(offset, 4); + + if (offset > end) { + return false; + } + + *offsetp = offset; + + return true; +} + static bool init_states(QEMU_Elf *qe) { Elf64_Phdr *phdr = elf64_getphdr(qe->map); - Elf64_Nhdr *start = (void *)((uint8_t *)qe->map + phdr[0].p_offset); - Elf64_Nhdr *end = (void *)((uint8_t *)start + phdr[0].p_memsz); Elf64_Nhdr *nhdr; GPtrArray *states; + QEMUCPUState *state; + uint32_t state_size; + uint64_t offset; + uint64_t end_offset; + char *name; if (phdr[0].p_type != PT_NOTE) { eprintf("Failed to find PT_NOTE\n"); @@ -74,15 +72,40 @@ static bool init_states(QEMU_Elf *qe) } qe->has_kernel_gs_base = 1; + offset = phdr[0].p_offset; states = g_ptr_array_new(); - for (nhdr = start; nhdr < end; nhdr = nhdr_get_next(nhdr)) { - if (!strcmp(nhdr_get_name(nhdr), QEMU_NOTE_NAME)) { - QEMUCPUState *state = nhdr_get_desc(nhdr); + if (uadd64_overflow(offset, phdr[0].p_memsz, &end_offset) || + end_offset > qe->size) { + end_offset = qe->size; + } - if (state->size < sizeof(*state)) { + while (offset < end_offset) { + nhdr = (void *)((uint8_t *)qe->map + offset); + + if (!advance_note_offset(&offset, sizeof(*nhdr), end_offset)) { + break; + } + + name = (char *)qe->map + offset; + + if (!advance_note_offset(&offset, nhdr->n_namesz, end_offset)) { + break; + } + + state = (void *)((uint8_t *)qe->map + offset); + + if (!advance_note_offset(&offset, nhdr->n_descsz, end_offset)) { + break; + } + + if (!strcmp(name, QEMU_NOTE_NAME) && + nhdr->n_descsz >= offsetof(QEMUCPUState, kernel_gs_base)) { + state_size = MIN(state->size, nhdr->n_descsz); + + if (state_size < sizeof(*state)) { eprintf("CPU #%u: QEMU CPU state size %u doesn't match\n", - states->len, state->size); + states->len, state_size); /* * We assume either every QEMU CPU state has KERNEL_GS_BASE or * no one has. From patchwork Mon Mar 11 19:12:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779423 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1689632wrt; Mon, 11 Mar 2024 12:20:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWmL5EWb9laABqFsQxT9juEF1FkFL1Sp58y2MZRbpMgBe5nII55XYK0IgIawFBAXESZLIEMeFGZQNs6eki7z0BJ X-Google-Smtp-Source: AGHT+IGwDKkFNNW+KX7HHMNnJE6dnUcH27WlVygvN1YHqoO+neQSpk20E7WGqJ94KF9DKCzzaJNq X-Received: by 2002:a05:6808:1189:b0:3c1:9b87:dd90 with SMTP id j9-20020a056808118900b003c19b87dd90mr1726813oil.34.1710184833813; Mon, 11 Mar 2024 12:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184833; cv=none; d=google.com; s=arc-20160816; b=fr5ArRCM4bdP6l4O/Sz5FGRCckQP6IyS46YghXxHPWeHDVVFN6ZYIzW7AOJA4umu8Q 90f/9Ln5U3dz8jq/PSrXQO5dHGTsWJJCbt8OQJb+2mTLKomwVvD6m7v3J8ew/Zd1oRa1 t0gFBRmy5PzylAAYb5JdNVHQZjPyH2AT2xsEZi3wnQqC08bmMSA4vxIjMuxI17be2Zri z9dYHi9GFioRKoaOiCu2xTvHfKVc8iLsxQfzH+jOwkb3phhEGia1JYx1BYZ8rqwpD478 huE9o3pQJOHBteY7eglTqWcmctI+BwsXvTZlwOW0+vpZaBwnMzjXJNOmc6eIJDXvPdRF xK4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=yKKx3IOByUMeAMGSYuM0l0stWjxVzOikFpYz9umacLc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Nn6mShvOFHjJ1BnCII/q3ABjQYPsAI+hPMaU7CnR4GVb/AYDs7W9Ym/C/D8IfVwVJT mnk+CNmxU0rOHUct88rQdXmbxpSLEhQlHJOqYfdSgh/1X3tASVxjumW3TYv04vui68Tt 53IZCivQ6y6LUAcu9ENrWAei1MCYfvyQHtjiWrsfEY79WXplVsHRMeCqCzTuSgeT7Y/T m6aitJseKQff47It1ouROE/yyo4fcMiIdBbR/tip2h30cLQgHXx/CgmKKbfsxX+8n56/ 8Eo1LzE9Bg32837/m+10d3grVwmjT0WnYgPbrSGw3XVLRQ58QdxG290uvzSGChS4Liqi DJpw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CKAogRjR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 4-20020a05621420c400b0068cbcf48e43si6435575qve.49.2024.03.11.12.20.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:20:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CKAogRjR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl80-0005Yf-PC; Mon, 11 Mar 2024 15:16:05 -0400 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 1rjl53-0003PJ-1x for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:03 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4x-0000Ns-4n for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:00 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-41331166961so1665875e9.1 for ; Mon, 11 Mar 2024 12:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184371; x=1710789171; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=yKKx3IOByUMeAMGSYuM0l0stWjxVzOikFpYz9umacLc=; b=CKAogRjR1/zANIGqogF7BS0hCbJyBf51vSWn7kuKGqETKdmwdaAaIhKTgOvge1EK+G ueceZAa0HXc/jF22wtAT9g1KSKFElFtNe3yvMoq6oaScV6t/PPiffERVa9dES03HGVac hlNUgxOC4jJmCuk/umuqf/iE29vLY4MiBkaGBr8Coa04KZlfCzRxc3pbceFFWaVdCwUF K+4hpPhuaDzOElvCxugFzPOVTVn8OHXuOSdEeIjTBrAiueMRhmOLcqR7QJf0w47PaBMa qcxmu7RAgVeuNKiJnSbCe2299lM5rHn9EKGhtkwY8aRMuNMErzQaSgCTjkfaWsIzleJq 0Z4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184371; x=1710789171; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yKKx3IOByUMeAMGSYuM0l0stWjxVzOikFpYz9umacLc=; b=NmziGU5Xnh2nqskR/+ctkcuoJ+sIkBSgOfr9OOZfIRB/O8/xdJ7hwIV7bTU4K9kIPO bLUrM8ZW7HotLzR0SxcyBKxAN9HRtxnjImDbzTMgZNBI4cHwuIGnwaQKBk3xiWckxwdH xRdBINIjIsBcVDu6C1Nh90c9VSQm7PFGj81mxt2+2CebxJHGGP2ZWVThO/hoeKaCRpuE fNMH9haECq7zWgZ9DH2HXrGrGzqOPEi72rxv7VdXHDzQL0th/p/j5+XLWAbrBIxnJfgy bsgJ/GZ6JME6LyQQwWStpLtgFIjL676nBlaRdRas7SdU3HScdnduG05vqm83tRuFP5VN Iexg== X-Gm-Message-State: AOJu0YzK4Si4NAdrEO1rejNz+B1eoaKUWbP0tSF9TIlbZuDI7VPRZTkW wdakuTrLLhHxiTkpPAIoTS9Xj4nvO0MVnbScCi7F47nLwDCE+IIkzIOHFmSPrxIFLnxkooXmBBA t X-Received: by 2002:a05:600c:6a1a:b0:413:1285:6e40 with SMTP id jj26-20020a05600c6a1a00b0041312856e40mr5673901wmb.20.1710184371490; Mon, 11 Mar 2024 12:12:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:51 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/20] contrib/elf2dmp: Ensure phdrs fit in file Date: Mon, 11 Mar 2024 19:12:40 +0000 Message-Id: <20240311191241.4177990-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki Callers of elf64_getphdr() and elf_getphdrnum() assume phdrs are accessible. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2202 Signed-off-by: Akihiko Odaki Tested-by: Viktor Prutyanov Reviewed-by: Peter Maydell Message-id: 20240307-elf2dmp-v4-19-4f324ad4d99d@daynix.com Signed-off-by: Peter Maydell --- contrib/elf2dmp/qemu_elf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/elf2dmp/qemu_elf.c b/contrib/elf2dmp/qemu_elf.c index 8d750adf904..c9bad6e82cf 100644 --- a/contrib/elf2dmp/qemu_elf.c +++ b/contrib/elf2dmp/qemu_elf.c @@ -132,6 +132,7 @@ static void exit_states(QEMU_Elf *qe) static bool check_ehdr(QEMU_Elf *qe) { Elf64_Ehdr *ehdr = qe->map; + uint64_t phendoff; if (sizeof(Elf64_Ehdr) > qe->size) { eprintf("Invalid input dump file size\n"); @@ -173,6 +174,13 @@ static bool check_ehdr(QEMU_Elf *qe) return false; } + if (umul64_overflow(ehdr->e_phnum, sizeof(Elf64_Phdr), &phendoff) || + uadd64_overflow(phendoff, ehdr->e_phoff, &phendoff) || + phendoff > qe->size) { + eprintf("phdrs do not fit in file\n"); + return false; + } + return true; } From patchwork Mon Mar 11 19:12:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 779431 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1690229wrt; Mon, 11 Mar 2024 12:22:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVIPkYsM+lW9Jt4BuOCVOzsPTDHG0CjrnrVk8jqqdV6e6e6ag7BNhj6sAXcvmOVmB3HUJZOLbkhoLHy56Q2LCpo X-Google-Smtp-Source: AGHT+IG/x0jF0JLd/PUPjPkd6ugTGj5XEbBaDa76dGDsRB7UYJJ2MKOp+zgAeeM9KDEWiSrXuErD X-Received: by 2002:a05:6359:4c89:b0:17c:1bd9:9be8 with SMTP id kk9-20020a0563594c8900b0017c1bd99be8mr8698300rwc.9.1710184927392; Mon, 11 Mar 2024 12:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710184927; cv=none; d=google.com; s=arc-20160816; b=RgAa3VIzI7NLCtbdR/0l1IHby0Z0ec+7fFp/CTwwtw+A0m9g+QXrGd6uihZ9l4NB2M YllTxgdAgiTejFgBU14X10Sq2gLxiSZUprYT44gpWibE0vWr2ysKVgws/G9JhQQUDkGI CO/iRks67gKmdeL/QfD3F7IvYPwCFpDcNPPSo02lSDqu335mwW5oXVi/8WzNQmsOb/48 pv+sQWTDb1mSERhcHtcC1WmM+5Di9ZSmTd9Ikvwe4tXTlYf5IqNRlZ/Bq2LEVYp06x/+ BPETGaxiAT2EzRs4WWrtL7USuI5PQtuSmG/fmsDeT2t1bgko1xl1ek1fbQW0EHKeB+GE APjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=bC+LUFs+cDKcgliQteAEFQtfSzHpjUGJyBcf3ZG4pxI=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=xv9lGd7u+njJMpSUlU2b4ppNMM2My5YYTrRjpiXXv8ypTqjJZR9P+H0G0XTCqrXy1I qXmDAVPpBG5V9aRga1fjj2qunE0U8CVRWSMhqclu/aXsxu5hXvwCXFHzglHy61AVCmt/ HfG+qwDHkFSNAY5F0hcnLqQpLwSLgOcF1K48QHCcQErcPbrJw3ChAb1evkO1i0rlShjJ wXV9wEWpwdT6gBOSs6OGxCPiRffUJIzsQfopigl9rZwhn9cgGtb++QWrP6liBAX0Kql6 u25v+2OVQbCJxrrgI2CTobF9f4mUyVSc4dtlVpqMmxvvYPgzt/MsCZREAFdDS/KFPyEt w5iQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P+k2VVBB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h11-20020ac8584b000000b0042ef395d52bsi6087855qth.257.2024.03.11.12.22.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Mar 2024 12:22:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P+k2VVBB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjl80-0005Yg-Pm; Mon, 11 Mar 2024 15:16:05 -0400 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 1rjl56-0003Qt-TN for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:08 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjl4v-0000Nz-V1 for qemu-devel@nongnu.org; Mon, 11 Mar 2024 15:13:03 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4132600824bso9417305e9.2 for ; Mon, 11 Mar 2024 12:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710184372; x=1710789172; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=bC+LUFs+cDKcgliQteAEFQtfSzHpjUGJyBcf3ZG4pxI=; b=P+k2VVBBKr35AZhwdStCq1bD1vcAtI/myZyGE13GwoRhIZQVSCaxkgFl62g6O1xtQI pSd5y9grh8z0YnU2phGKJ9OcPgAa39/BZG33ePr0z2iaSC/dapN4L9Naj/lSIaMQ59eE EDVKICcKfamHu9uC3BQuF/rtLkHPv4L09nXH/pCToWQGFnJq6IJhcf+1WsUgGyoi1vVp 4TKO66aQut2iv3PYV4YJcAyKDBlt+uJvgzjbEXoizX5GrriTAzmod1ZqTaJTQTRUgkev wvnYCEuJToy1FxhPMNyaivhJDPtl7PgzBLtUe7i2QrD2VwW6LVT16AU7UKyG1TVEefAa jhyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710184372; x=1710789172; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bC+LUFs+cDKcgliQteAEFQtfSzHpjUGJyBcf3ZG4pxI=; b=KXKq47XNPnU60noTa9M1bQZvNpwEO6ZWuHYDWvSE8qlqNzmxyjlPI9ZCjq2/92Q0HY CacXPcdHy6HmzssuiKpNca2cfnN+RvLsrBnbtwOuG5PtY9Qe4zKuSxWWqauo+qj1fAFK Hy3i5U4l77YBwj7AiwEGMabnX8mFPy0TYTATONPDr7jLspsJqWNI00g2oeWepON/auWe d4g543gy9+w3VaRaeOgAjUsVfMGBC5G4ECws/Xv0Bv1tbVSa3edKl+wQD52yVNDjVYGL q1qvj46UuJ/XBlGWyuHl3Ynke3z1qJw9RnEWC9YeDrsDwcG0EB7vb5810uBbCSuGf9+0 4rRA== X-Gm-Message-State: AOJu0Yx+D8YqGO5WEQ39HlmAklxr/y/Zu1lPraJM5dBTvk/vEFFEfW1x qLX/HS00D7X3WKh8f/HDbLDQioFtIpzc0q57s91tS4NFecU5VS81lORC2npQeKa77Hk336lREj0 w X-Received: by 2002:a05:600c:5405:b0:413:1921:8698 with SMTP id he5-20020a05600c540500b0041319218698mr1076420wmb.41.1710184371875; Mon, 11 Mar 2024 12:12:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c450a00b004131388d948sm14425266wmo.0.2024.03.11.12.12.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 12:12:51 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/20] docs: update copyright date to the year 2024 Date: Mon, 11 Mar 2024 19:12:41 +0000 Message-Id: <20240311191241.4177990-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311191241.4177990-1-peter.maydell@linaro.org> References: <20240311191241.4177990-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ani Sinha We are already in the third month of 2024 but the copyright notices still refer to 2023. Update the date to 2024 in documentation and help texts. Cc: peter.maydell@linaro.org Cc: qemu-trivial@nongnu.org Signed-off-by: Ani Sinha Reviewed-by: Peter Maydell Message-id: 20240311120346.9596-1-anisinha@redhat.com Signed-off-by: Peter Maydell --- docs/conf.py | 2 +- include/qemu/help-texts.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 1b2afa241c0..aae0304ac6e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -88,7 +88,7 @@ # General information about the project. project = u'QEMU' -copyright = u'2023, The QEMU Project Developers' +copyright = u'2024, The QEMU Project Developers' author = u'The QEMU Project Developers' # The version info for the project you're documenting, acts as replacement for diff --git a/include/qemu/help-texts.h b/include/qemu/help-texts.h index d0359f82e08..353ab2ad8b0 100644 --- a/include/qemu/help-texts.h +++ b/include/qemu/help-texts.h @@ -2,7 +2,7 @@ #define QEMU_HELP_TEXTS_H /* Copyright string for -version arguments, About dialogs, etc */ -#define QEMU_COPYRIGHT "Copyright (c) 2003-2023 " \ +#define QEMU_COPYRIGHT "Copyright (c) 2003-2024 " \ "Fabrice Bellard and the QEMU Project developers" /* Bug reporting information for --help arguments, About dialogs, etc */