From nobody Thu Nov 13 13:34:25 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1580605718851142.69756267840216; Sat, 1 Feb 2020 17:08:38 -0800 (PST) Received: from localhost ([::1]:52188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iy3kb-00036R-Qt for importer@patchew.org; Sat, 01 Feb 2020 20:08:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45635) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iy3gy-0003dM-5A for qemu-devel@nongnu.org; Sat, 01 Feb 2020 20:04:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iy3gx-00024I-4Z for qemu-devel@nongnu.org; Sat, 01 Feb 2020 20:04:52 -0500 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:34090) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iy3gw-00022w-UJ for qemu-devel@nongnu.org; Sat, 01 Feb 2020 20:04:51 -0500 Received: by mail-pg1-x541.google.com with SMTP id j4so5748889pgi.1 for ; Sat, 01 Feb 2020 17:04:50 -0800 (PST) Received: from cloudburst.WiFi.IPv4InfoBelow (h210.212.133.40.static.ip.windstream.net. [40.133.212.210]) by smtp.gmail.com with ESMTPSA id 13sm14678975pfi.78.2020.02.01.17.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Feb 2020 17:04:49 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=U1CXib6JNYX6xUt67ormhDS8FAN7+A7WszdUWC4DAwU=; b=vUh6Ca+UaYzIBPj9QmdQoAB8fVRDMeiEbBjr2APcdq7JQqfuPmI9PTFQ+RC9bsO/EY 5ZRe7Gvaj6aaqiNahLoreV19WaDePDKbprA5FqvCDyrUkhWmGsIyvRDzBeK8sM9XnTbn oqBW7fHxQtliiQc0DgkgbGvEU5dTockkbpu9E+pXe3XfjyxYVDaYfMO4JY3Ue9Lx9/E+ zLMgeTFB0sv6Tz+72aac3uVmi8zmDgkSpxrZEDYIiXG9cTkN/6VtSsGRWdhA0AvDDcAX 1HqVnmbldnQoF+C445l4X31ymyY2/Gs980N1klyOhpW+1LWfkjdPr+xL9+A5+rmQYl5P GJBA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=U1CXib6JNYX6xUt67ormhDS8FAN7+A7WszdUWC4DAwU=; b=D98GqwXqEGjVED2sU39Qlq/CHnbq7+adR3yqEMomujgjDQTJEr7vmggERryKwi4bp9 pMWmHh97Hmencjwwhn2CqdYZ/kuZujU2KdM0jI1cVDgWuYxv+aPrt4JXIQQpPE8xHG3W Se0aGHeoZ9fUqBsYCep56yhEQVz6cUuJCLhtr0dD0lNaZIV8x9RC57IVYwq1cN984VbP 1Z15KgDxDvSrmwpGHjxLuj4X00h2y60v2q7DU+sbpUwuX6SzMcnxc0yuwIYeYkRutXg7 jfsowZfVbS+pogKPpRIXKIOvMjCEHcecJKqczmgEUgDUQb2/7fOZmV6bn9F3BbDWMpN5 JMOQ== X-Gm-Message-State: APjAAAVuWgtHLInmpLpsWmj7SdKroY1k8miaw39aHSNX7k7oaodKpZ/7 8EHtMf/ah7TeklPIja6dbZmdy0W6LAg= X-Google-Smtp-Source: APXvYqx31egw9nUshmCihxP2bBcOIAkgU0CVLuRPU/pc5yXIDcYpVKYhzanTHZyct80QGVJ05p4WfA== X-Received: by 2002:aa7:947b:: with SMTP id t27mr18395390pfq.212.1580605489713; Sat, 01 Feb 2020 17:04:49 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 07/14] target/arm: Enforce PAN semantics in get_S1prot Date: Sat, 1 Feb 2020 17:04:32 -0800 Message-Id: <20200202010439.6410-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200202010439.6410-1-richard.henderson@linaro.org> References: <20200202010439.6410-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::541 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" If we have a PAN-enforcing mmu_idx, set prot =3D=3D 0 if user_rw !=3D 0. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- target/arm/internals.h | 13 +++++++++++++ target/arm/helper.c | 3 +++ 2 files changed, 16 insertions(+) diff --git a/target/arm/internals.h b/target/arm/internals.h index 6be8b2d1a9..819de9037f 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -893,6 +893,19 @@ static inline bool regime_is_secure(CPUARMState *env, = ARMMMUIdx mmu_idx) } } =20 +static inline bool regime_is_pan(CPUARMState *env, ARMMMUIdx mmu_idx) +{ + switch (mmu_idx) { + case ARMMMUIdx_Stage1_E1_PAN: + case ARMMMUIdx_E10_1_PAN: + case ARMMMUIdx_E20_2_PAN: + case ARMMMUIdx_SE10_1_PAN: + return true; + default: + return false; + } +} + /* Return the FSR value for a debug exception (watchpoint, hardware * breakpoint or BKPT insn) targeting the specified exception level. */ diff --git a/target/arm/helper.c b/target/arm/helper.c index 638abe6af0..18e4cbb63c 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -9578,6 +9578,9 @@ static int get_S1prot(CPUARMState *env, ARMMMUIdx mmu= _idx, bool is_aa64, if (is_user) { prot_rw =3D user_rw; } else { + if (user_rw && regime_is_pan(env, mmu_idx)) { + return 0; + } prot_rw =3D simple_ap_to_rw_prot_is_user(ap, false); } =20 --=20 2.20.1