From patchwork Fri Jan 23 18:20:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 43688 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D8355218DB for ; Fri, 23 Jan 2015 18:20:46 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id n3sf2258486wiv.0 for ; Fri, 23 Jan 2015 10:20:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Kjq2QfvmpkXfWrPk+vGU8YCWjtHOhQd2USt06gqa3jA=; b=B+0zwcE0s9BJ2UPcqqHsnUC0kqI7xuZuNCGWDE+DuQyPZmsDBuM41Rwi/Tzc0N7bbs 2qyCntHhxiC1DifK9bTxRRzAfoeOVJ3DrRoijvqt85A/BSlEIrej0ABW/DGGvA5oD8JB YRDJNJRimHP7/5m3QDy+gFfw1uU4sSyaBQHJYH0cypQfQ+dMNxOQP80JRXXsTXJITRQs Q4wzqBVTBy+eOcCKpgAE2VYwvOU1mW+laKKChJe0J02WJBqtWm6/kpl2fWXla9yeQvOg joy3R3JnPnTwRtSPY3xK43H2icPENVLYsWbuL61BctZtt6XZsplt0TVWPdoT0CrSN0mF T55A== X-Gm-Message-State: ALoCoQnNBzyYlYJEdtQyP25eghF+fEo5BCiGumaCHMril7MPYMPpF6BHPaYD2+fsgx33XFIhdu0F X-Received: by 10.152.3.234 with SMTP id f10mr1198572laf.1.1422037246153; Fri, 23 Jan 2015 10:20:46 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.166 with SMTP id t6ls273945lat.38.gmail; Fri, 23 Jan 2015 10:20:45 -0800 (PST) X-Received: by 10.152.42.164 with SMTP id p4mr997203lal.45.1422037245937; Fri, 23 Jan 2015 10:20:45 -0800 (PST) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id ll1si2041222lac.41.2015.01.23.10.20.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Jan 2015 10:20:45 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id f15so8477101lbj.5 for ; Fri, 23 Jan 2015 10:20:45 -0800 (PST) X-Received: by 10.112.44.230 with SMTP id h6mr8770671lbm.98.1422037245862; Fri, 23 Jan 2015 10:20:45 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.9.200 with SMTP id c8csp344110lbb; Fri, 23 Jan 2015 10:20:44 -0800 (PST) X-Received: by 10.68.219.33 with SMTP id pl1mr3203619pbc.93.1422037235410; Fri, 23 Jan 2015 10:20:35 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id r2si2182400pde.8.2015.01.23.10.20.33 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 23 Jan 2015 10:20:35 -0800 (PST) Received-SPF: none (google.com: pm215@archaic.org.uk does not designate permitted sender hosts) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1YEiqK-0001PA-CL; Fri, 23 Jan 2015 18:20:28 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Greg Bellows , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Edgar E. Iglesias" , Andrew Jones Subject: [PATCH 03/11] target-arm/translate-a64: Fix wrong mmu_idx usage for LDT/STT Date: Fri, 23 Jan 2015 18:20:20 +0000 Message-Id: <1422037228-5363-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1422037228-5363-1-git-send-email-peter.maydell@linaro.org> References: <1422037228-5363-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The LDT/STT (load/store unprivileged) instruction decode was using the wrong MMU index value. This meant that instead of these insns being "always access as if user-mode regardless of current privilege" they were "always access as if kernel-mode regardless of current privilege". This went unnoticed because AArch64 Linux doesn't use these instructions. Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Reviewed-by: Greg Bellows --- I'm not counting this as a security issue because I'm assuming nobody treats TCG guests as a security boundary (certainly I would not recommend doing so...) --- target-arm/translate-a64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c index 80d2359..dac2f63 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -2107,7 +2107,7 @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn) } } else { TCGv_i64 tcg_rt = cpu_reg(s, rt); - int memidx = is_unpriv ? 1 : get_mem_index(s); + int memidx = is_unpriv ? MMU_USER_IDX : get_mem_index(s); if (is_store) { do_gpr_st_memidx(s, tcg_rt, tcg_addr, size, memidx);