From nobody Sat Jun 29 05:24:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548699951867546.1490073647199; Mon, 28 Jan 2019 10:25:51 -0800 (PST) Received: from localhost ([127.0.0.1]:36580 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goBbL-0005zM-R0 for importer@patchew.org; Mon, 28 Jan 2019 13:25:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40848) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goBN7-0002cf-3g for qemu-devel@nongnu.org; Mon, 28 Jan 2019 13:11:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goBN5-0008Ha-3a for qemu-devel@nongnu.org; Mon, 28 Jan 2019 13:11:00 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:46328) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1goBN1-00089I-O7 for qemu-devel@nongnu.org; Mon, 28 Jan 2019 13:10:57 -0500 Received: by mail-wr1-x441.google.com with SMTP id l9so19087392wrt.13 for ; Mon, 28 Jan 2019 10:10:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id b18sm97910681wrw.83.2019.01.28.10.10.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Jan 2019 10:10:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ksbbs4eq/TMj7Xsvipvw1RXYQf1Zrz8wpVuGlt97Emk=; b=dkifgWUr8YxNfUtnzfF03ZvDpu8e+hawmPGgyo3iqNbchuTo5aHGkaO7ZDIsrLxCo6 1W5vZ/YwY5T1SzdQuB4K5npiktwdimFTZUrcMJTCdh2y70zrXnoqTR3KT27IYZcKRgez 55+0gs5P+jcdUazqOloYT7j1nExnKLbZ0Gq0M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ksbbs4eq/TMj7Xsvipvw1RXYQf1Zrz8wpVuGlt97Emk=; b=DQJhM1mMGHec/gEeF4cu9g4AT2gY+nEX/vrB0ujlfcw59NBIzMFxw696Zb3rdAJxmt Uz+NURL1jU5UsJp4S/IFGm9Es3LRpfOYPBdEAGlOEenb6JG9V+mVksXf63kCB9xQ7IfK izBWCWhshMlz95su9jatV1M+lH0kjPgnP+C9xDc+fEsuKO5h6yK7JXVZHGSZ5h0CAZ/E A1teqYkduzqXaIetu1V65lVc9NNVmVrtvHZmXhJKhFghLnJ6N68ZbpYtxXvf59N02Cby h09L8n54br0GxXU9yfyqPxv+DFSGS5UwK4Spmnm9IjI68mvF4q/zuoGm9l6flr89CzVb nvEQ== X-Gm-Message-State: AJcUuke7x1zgGxUeQxAqGvhu11MVtcPc1LIrFcKeblT6IA+GBX2fYGlt +ipZYgZ/1U36nB9wWmPcZZpEmHoSnwA9dQ== X-Google-Smtp-Source: ALg8bN7snab4WOx41fjvFIfv/0FMAV2xkZMfv4VLatnUHU365pKFmfLC2efY+yZ5IodPOXiztOKUlg== X-Received: by 2002:adf:9361:: with SMTP id 88mr22179424wro.204.1548699052783; Mon, 28 Jan 2019 10:10:52 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 28 Jan 2019 18:10:23 +0000 Message-Id: <20190128181047.20781-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128181047.20781-1-peter.maydell@linaro.org> References: <20190128181047.20781-1-peter.maydell@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: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PULL 02/26] target/arm: v8m: Ensure IDAU is respected if SAU is disabled 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Thomas Roth The current behavior of v8m_security_lookup in helper.c only checks whether= the IDAU specifies a higher security if the SAU is enabled. If SAU.ALLNS is set= to 1, this will lead to addresses being treated as non-secure, even though the IDAU indicates that they must be secure. This patch changes the behavior to also check the IDAU if the SAU is curren= tly disabled. (This brings the behaviour here into line with the v8M Arm ARM SecurityCheck() pseudocode.) Signed-off-by: Thomas Roth Message-id: CAGGekkuc+-tvp5RJP7CM+Jy_hJF7eiRHZ96132sb=3DhPPCappKg@mail.gmai= l.com Reviewed-by: Peter Maydell [PMM: added pseudocode ref to the commit message, fixed comment style] Signed-off-by: Peter Maydell --- target/arm/helper.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index e24689f7677..676059cb386 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11078,18 +11078,19 @@ static void v8m_security_lookup(CPUARMState *env,= uint32_t address, } } } - - /* The IDAU will override the SAU lookup results if it specifies - * higher security than the SAU does. - */ - if (!idau_ns) { - if (sattrs->ns || (!idau_nsc && sattrs->nsc)) { - sattrs->ns =3D false; - sattrs->nsc =3D idau_nsc; - } - } break; } + + /* + * The IDAU will override the SAU lookup results if it specifies + * higher security than the SAU does. + */ + if (!idau_ns) { + if (sattrs->ns || (!idau_nsc && sattrs->nsc)) { + sattrs->ns =3D false; + sattrs->nsc =3D idau_nsc; + } + } } =20 static bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address, --=20 2.20.1