From patchwork Thu Jan 25 13:43:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 125840 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1124796ljf; Thu, 25 Jan 2018 05:50:21 -0800 (PST) X-Google-Smtp-Source: AH8x224S2qxaA73fdPfjCUA/JEG3dzQx3KApIO1+P8TD16xnkF/HavXbcaidGbWjKO2D3JtJPkrK X-Received: by 10.37.210.71 with SMTP id j68mr8104378ybg.205.1516888221323; Thu, 25 Jan 2018 05:50:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516888221; cv=none; d=google.com; s=arc-20160816; b=y76fVWtvVfDMFylTSnsTMLhdCqb+GNcKsAOEEUEezBYwFt5nUFmOSJ6XzRUucSbgLV o1wyV1amq8ilXe2Nf+Bm2eshc6hTe8/9nrd+UWvDqrleA6cktZKsQM3z0/bNz0uVeZdF eG/iKM1QHjyevtISQANA3g+jtjeM6xgE2VBXvJUxL29lpHnNWn+CX6Xp7btQPUn3ZZNd uH/RPjUeiuep1mUXaagtqoSPEaHpl5BTl4eQwHC7Ovl5cwdXHv0OSPml+MU4u+fJmXsX 7VO+ashD7Cs8UkFbIpJOOtAnoEr5xZvT9CQJfvASYT8X6j/o4g9aSzeoyqKilH7zIiSF DnTg== 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:subject:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=wIBCkPBJuKh+fYJOrK/bS842paWVg3/7/S95r4Unhmo=; b=aNdcfrDKMOYrTXX79UH+nMokDx3kw2ZcYopi6VHPqByQxNT4241KEl3Y1OIV1/ZpSF LDybIEuaCmGJ/liMK17Tr6SzslQHuz0OW2y/GFks+XP4RKzeOQDbLCu/0g58I4C04Lp5 FOpyKrxYX+Me0hTw2P848su2Lec8AOnZEzqCFBLAX8G+pc69GD2ckoDne8ybso+n2ESz qsUILOQ/XwEEZXKoJ2/gptfnD9VDHezoJBcbAtNSByzz6EmX+3HZjmuQPNwfDgvSrGOc tG3s5LCf2omYqhjB0HJCFHU6tQ7e8eHL3BFFSF8bcOMOKvbhefRxWzZ1FYZdHqjbZ4Uv NFGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id e203si477004ywc.711.2018.01.25.05.50.21 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 25 Jan 2018 05:50:21 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41409 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eehv2-0008JZ-Jg for patch@linaro.org; Thu, 25 Jan 2018 08:50:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eehog-0003Ec-8B for qemu-devel@nongnu.org; Thu, 25 Jan 2018 08:43:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eehof-00038S-86 for qemu-devel@nongnu.org; Thu, 25 Jan 2018 08:43:46 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:45986) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eehof-00035J-03 for qemu-devel@nongnu.org; Thu, 25 Jan 2018 08:43:45 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1eehoR-0006pS-Dh for qemu-devel@nongnu.org; Thu, 25 Jan 2018 13:43:31 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 25 Jan 2018 13:43:09 +0000 Message-Id: <1516887809-6265-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516887809-6265-1-git-send-email-peter.maydell@linaro.org> References: <1516887809-6265-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 01/21] 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Ard Biesheuvel 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 Message-id: 20180119194648.25501-1-ard.biesheuvel@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/target/arm/helper.c b/target/arm/helper.c index c83c901..bd05f8a 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8360,7 +8360,7 @@ static uint64_t arm_ldq_ptw(CPUState *cs, hwaddr addr, bool is_secure, MemTxAttrs attrs = {}; MemTxResult result = MEMTX_OK; AddressSpace *as; - uint32_t data; + uint64_t data; attrs.secure = is_secure; as = arm_addressspace(cs, attrs);