From nobody Fri May 3 05:02:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516391323014549.3523852823432; Fri, 19 Jan 2018 11:48:43 -0800 (PST) Received: from localhost ([::1]:40889 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecceP-0002Z7-8e for importer@patchew.org; Fri, 19 Jan 2018 14:48:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecccz-0001mv-Lj for qemu-devel@nongnu.org; Fri, 19 Jan 2018 14:47:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecccw-0000OT-Fa for qemu-devel@nongnu.org; Fri, 19 Jan 2018 14:47:05 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:41072) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecccw-0000O4-93 for qemu-devel@nongnu.org; Fri, 19 Jan 2018 14:47:02 -0500 Received: by mail-wm0-x243.google.com with SMTP id f71so5510799wmf.0 for ; Fri, 19 Jan 2018 11:47:02 -0800 (PST) Received: from localhost.localdomain ([160.170.62.40]) by smtp.gmail.com with ESMTPSA id 44sm4615608wrt.46.2018.01.19.11.46.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jan 2018 11:46:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=spmiuQiVwIIVZQMmZ2yW7UqCGF/PnY1JzYNoJ3f10VM=; b=XIr5bTliCDC5gIJtTZ49BSaJ1uxSJyJa6W6XAlGADijdsmclMItTmy/PKp11lNS003 kfwwLtp4oDW/POpMCCqPHC1xO/VwcCB1MLN3ogav3Xg6wLdl4szSI48eYdR7NbapurUo D06B8XsMWJl3cEKYHn29tXnTfUV5hD84ycA7U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=spmiuQiVwIIVZQMmZ2yW7UqCGF/PnY1JzYNoJ3f10VM=; b=c8vPY/uKHseoQg8Cx4NVKU4pqmDp1VlvmkkrUc2Rrm3GB7BvQBjFXexefl2tP3GcCb mFtUEqe/OmGHlF9P9bEh4rUnlj3iwhy9sqfSPgy46dag5n1jguUl/TDyfb6MAzoSDTUE RDK38Z++4y2k7+/JCcSwPbe8Fkpvu9pRUCaqcEk1Lu4h8eYMLouNBZj2bz3zqdfq7MvV lnrpWzwNcaTCfhxM6kyjdFITLGIxNaDoXdtEoMaCEdsKw3ypRqI7cZjrvaj5D8aAyAJR H0u6uztd8Ajv0ZlRHq8xJxdKYBBj8r3wupmQgdFOP9XxoLnfI/8+p1e6k9RXcbgTG+7T DM9w== X-Gm-Message-State: AKwxytdbrpj2bzBNxiW84PWPXvBNX52/Gn3sz2osTElMEiVpfq85xPBM VbHtPL6IsgdokUQBH37KmtG8B4MyefM= X-Google-Smtp-Source: AH8x227YNk9+yC7+q5GfLhXQozbu+B0RUdXWfrcTE8J1gsXokVfyoQuX/gwc0zcHifQTyYgeh031Gg== X-Received: by 10.28.15.131 with SMTP id 125mr33482wmp.24.1516391220800; Fri, 19 Jan 2018 11:47:00 -0800 (PST) From: Ard Biesheuvel To: qemu-devel@nongnu.org Date: Fri, 19 Jan 2018 19:46:48 +0000 Message-Id: <20180119194648.25501-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PATCH] target/arm: Fix 32-bit address truncation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Ard Biesheuvel , rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Commit ("3b39d734141a target/arm: Handle page table walk load failures correctly") modified both versions of the page table walking code (i.e., arm_ldl_ptw and arm_ldq_ptw) to record the result of the translation in a temporary 'data' variable so that it can be inspected before being returned. However, arm_ldq_ptw() returns an uint64_t, and using a temporary uint32_t variable truncates the upper bits, corrupting the result. This causes problems when using more than 4 GB of memory in a TCG guest. So use a uint64_t instead. Signed-off-by: Ard Biesheuvel --- target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 67059033019c..a41b6c3a1b82 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8368,7 +8368,7 @@ static uint64_t arm_ldq_ptw(CPUState *cs, hwaddr addr= , bool is_secure, MemTxAttrs attrs =3D {}; MemTxResult result =3D MEMTX_OK; AddressSpace *as; - uint32_t data; + uint64_t data; =20 attrs.secure =3D is_secure; as =3D arm_addressspace(cs, attrs); --=20 2.11.0