From patchwork Tue Jun 12 20:24:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 138381 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5815916lji; Tue, 12 Jun 2018 13:27:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIBVv+Uh8Zb8AHIZeKekmBCNQjM4EeYL1GH3ywnUEdFY8/znAbv6/lRdRNQdsO1C9qtYJrG X-Received: by 2002:adf:e4cd:: with SMTP id v13-v6mr1753127wrm.238.1528835261009; Tue, 12 Jun 2018 13:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528835260; cv=none; d=google.com; s=arc-20160816; b=DKnlP8n9q5Y7EySt/S+5S5WAZks8cUswhUbzXS17mAY9jYFAfxAj9uHobhWH7i0AJf ZQdxggXStcIhe5iVhMr/HWOMLeoIQO+9KJEOtpyXoKBFhnaeIBpU4eo6cKNnm7wKpEhd xdo1hFvp7C5EjDx/iORzHNzhgwn75iUlN1UXBi3l2sj9XgiOqPoNhkyMaB0GKFaYyQFI Zq9lCRO/f4HFhwjt3hIXc816d3Ly52EQynwoyHYK3fNCOnr49DASBta+esiH64fOgFOM 6YjVFxllkgYr5xvfZQJBGa9F+RNgaTCHOOoF+gvvSXTl36L8YT6X4a/A0RJtWWz4Leas KdjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=IQvQDtrWzobGxgViav0/zr0efJexxxLwfKJaz+jqEyQ=; b=NEDVPdL7h6au+gIdp/o5bBB52zDnhwnXW+ZGeJvj6pdL9e3pxyOpOJgBTbKu0tY8Vm yo8k2kxcl986lLrMA2IBExMPjwCGbrlIR+zf3s++9otggESHvq+EmkAUkCLs8LRF2OCe iBzdYlMP6ftwhRXBUlN5ZhBRzllu8QpYMhUtogdwrfhDPZkQpEvL/TPiDxAmBhIZEq5t x/ZI3pJLaxYOEk5MJ8OtybALB4bEyDZlYP5BQEX5Zgu8G7cRTsaOMIvhG8bjkuHa5rxR WP/HCc9HlM+kYZobL2VT+AnqpR+yTl72Cxrs/Dcu0UsMlIdDHoSsQTIR6/8T4mkWajQz farA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=ckw6LlT1; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=QUARANTINE sp=NONE dis=QUARANTINE) header.from=ti.com Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id g25-v6si920216eda.331.2018.06.12.13.27.40; Tue, 12 Jun 2018 13:27:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=ckw6LlT1; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=QUARANTINE sp=NONE dis=QUARANTINE) header.from=ti.com Received: by lists.denx.de (Postfix, from userid 105) id 944F1C21E26; Tue, 12 Jun 2018 20:25:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=KHOP_BIG_TO_CC, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 8F0C1C21D65; Tue, 12 Jun 2018 20:24:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0C316C21C6A; Tue, 12 Jun 2018 20:24:37 +0000 (UTC) Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by lists.denx.de (Postfix) with ESMTPS id 6EE39C21C27 for ; Tue, 12 Jun 2018 20:24:35 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w5CKODGc002681; Tue, 12 Jun 2018 15:24:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1528835053; bh=uuJMPpftT0qN2v3iDWzOw80+IY4nlQgBbXrNGnlcEAY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ckw6LlT1m+SLXkbRTDeZT/z5PvZ9HquO1qDOo3HWEw8LZAjTU2lwMCZPHrVycbWXM KGf/M80ueduQaf+/B2DObtSN8xwtzEoxOwXewp7hxbgrOwoOTCP3TAzvVkNcpVr0/R HiRYI2eA1Yzm2OIJy3NnshPIAT4Y9sqdAEg2cDJw= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w5CKODEG011472; Tue, 12 Jun 2018 15:24:13 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 12 Jun 2018 15:24:12 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Tue, 12 Jun 2018 15:24:12 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w5CKOCLf030864; Tue, 12 Jun 2018 15:24:12 -0500 From: Nishanth Menon To: Tom Rini , Russell King , Marc Zyngier , Catalin Marinas , Will Deacon , Tony Lindgren Date: Tue, 12 Jun 2018 15:24:08 -0500 Message-ID: <20180612202411.29798-2-nm@ti.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180612202411.29798-1-nm@ti.com> References: <20180612202411.29798-1-nm@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: Ard Biesheuvel , Andre Przywara , U-Boot-Denx , Christoffer Dall , Robin Murphy , linux-arm-kernel@lists.infradead.org Subject: [U-Boot] [PATCH 1/4] ARM: Introduce ability to enable ACR::IBE on Cortex-A8 for CVE-2017-5715 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" As recommended by Arm in [1], IBE[2] has to be enabled unconditionally for BPIALL to be functional on Cortex-A8 processors. Provide a config option for platforms to enable this option based on impact analysis for products. NOTE: This patch in itself is NOT the final solution, this requires: a) Implementation of v7_arch_cp15_set_acr on SoCs which may not provide direct access to ACR register. b) Operating Systems such as Linux to provide adequate workaround in the right locations. c) This workaround applies to only the boot processor. It is important to apply workaround as necessary (context-save-restore) around low power context loss OR additional processors as necessary in either firmware support OR elsewhere in OS. [1] https://developer.arm.com/support/security-update [2] http://infocenter.arm.com/help/topic/com.arm.doc.ddi0344k/Bgbffjhh.html Cc: Marc Zyngier Cc: Russell King Cc: Tony Lindgren Cc: Robin Murphy Cc: Florian Fainelli Cc: Catalin Marinas Cc: Will Deacon Cc: Christoffer Dall Cc: Andre Przywara Cc: Ard Biesheuvel Cc: Tom Rini Cc: Michael Nazzareno Trimarchi Signed-off-by: Nishanth Menon Tested-by: Fabio Estevam --- arch/arm/Kconfig | 5 +++++ arch/arm/cpu/armv7/start.S | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index dde422bc5d53..9e32d5b43cb0 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -108,6 +108,8 @@ config SYS_ARM_MPU # CONFIG_ARM_ERRATA_621766 # CONFIG_ARM_ERRATA_798870 # CONFIG_ARM_ERRATA_801819 +# CONFIG_ARM_CORTEX_A8_CVE_2017_5715 + config ARM_ERRATA_430973 bool @@ -177,6 +179,9 @@ config ARM_ERRATA_852423 config ARM_ERRATA_855873 bool +config ARM_CORTEX_A8_CVE_2017_5715 + bool + config CPU_ARM720T bool select SYS_CACHE_SHIFT_5 diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index c996525f861e..3beaf5a93d81 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -252,12 +252,15 @@ skip_errata_801819: pop {r1-r5} @ Restore the cpu info - fall through #endif -#ifdef CONFIG_ARM_ERRATA_430973 +#if defined(CONFIG_ARM_ERRATA_430973) || defined (CONFIG_ARM_CORTEX_A8_CVE_2017_5715) mrc p15, 0, r0, c1, c0, 1 @ Read ACR +#ifdef CONFIG_ARM_CORTEX_A8_CVE_2017_5715 + orr r0, r0, #(0x1 << 6) @ Set IBE bit always to enable OS WA +#else cmp r2, #0x21 @ Only on < r2p1 orrlt r0, r0, #(0x1 << 6) @ Set IBE bit - +#endif push {r1-r5} @ Save the cpu info registers bl v7_arch_cp15_set_acr pop {r1-r5} @ Restore the cpu info - fall through