From patchwork Mon Feb 26 08:20:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 10241597 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 39AB460386 for ; Mon, 26 Feb 2018 08:40:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A85E29D2C for ; Mon, 26 Feb 2018 08:40:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E23729D27; Mon, 26 Feb 2018 08:40:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9297329D67 for ; Mon, 26 Feb 2018 08:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TXPyKSt4klrCBjlqEjKlf0kyarn27QzZ4Pxuq8t9WBU=; b=fW2pkKR9PJIqao cxbf7gwn5N9PhCfpWpkjbXRP3TCEA7sxxw2ukc9cJhB+tlyqb4suuBkda5sGykRkJFOYlptR2QGrV 8ayoAf5OxgGHzrxkOjK/QFjEb3ON8/cf6nlv4+noN58Vcy9btTULo63uYpNcPC6zei28aXsAskZGq jKcV2SHkpokAcHkCxkMKbNj7zzGFcE7/zY8liZQtd+hY/zG/ymxm8fGhWSE/fUA5Zm37D6RZ8Qtvd oX7dhWRfYKUNACvHcwr6Rf2kCG9WB9GHgYkRtd+IDHgZF9fTY53jQ/cq3kCBcA2ZiJqNidHDJiF74 ZZKFM/turome7/5kr+Lg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eqEKI-0006Ox-DN; Mon, 26 Feb 2018 08:40:02 +0000 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eqE8V-000502-4r for linux-arm-kernel@lists.infradead.org; Mon, 26 Feb 2018 08:28:17 +0000 Received: by mail-pg0-x243.google.com with SMTP id l131so5914252pga.2 for ; Mon, 26 Feb 2018 00:27:40 -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; bh=TZy7LbCE06w5P4ocO94iT/5aR/zA6c96V+vApCDKSFE=; b=OfTMe6MGoKUHFGHU9OxUtwkc8u9CS1aPau9TvxDAM3avnGYMHCgq0SDhAXDKkBwTwF 3HYJUrBFoBQh+OKmL1Xr3bomSyAxicLHBH3dPXAIhyp9NLaQELuePug3yhfuIHa9ScuH TO7tnHEAri4iGkfFggSbD3jz9wOYXqOeyQSs4= 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; bh=TZy7LbCE06w5P4ocO94iT/5aR/zA6c96V+vApCDKSFE=; b=CvW+/olQ491knIakEIWOD2i+0wkPv9nhfT0h87qgaFoOqkR2hDR0kOU7i3X/wx1xX1 GHi9rFZCg/Fo3l2DIqwFGfGeFGGjjDKQiedKRQyYj/tyln81MNiWbU72jZTePutzDRNh OMjV68Zz0i1mUkaQjO/MAV2JRdYV2UvLS99el+YJawLtVl1GIIYlA2MoEbN2X9OTfR1n QskaVHFFuKNiyu+UBCPlrypdWSPh3AYIo540+qk6F5nv8j+NJtpUfXcnpgxhrqN021TP bW/sfvMez34nx5ZlGHF7KoItxlCMFyr+WSdMkmbh4C7sLUA9sPjzoyCDgyVnYTOg1Vxs KB0g== X-Gm-Message-State: APf1xPDgF/QtseIuY8gXRdPc+vL1+rXtRT2buT/adD+V+sKvJ5QrsZqP pE5NCBsca4Awz9JFUCi2h6zvsg== X-Google-Smtp-Source: AH8x227MqUeEVCGm07uKULLGNfsMO2P2X4nMU9d1Psa9gsiwLW+FD51YIOlRxQxM+BTMd6EKlfmoew== X-Received: by 10.99.150.2 with SMTP id c2mr7981687pge.424.1519633659812; Mon, 26 Feb 2018 00:27:39 -0800 (PST) Received: from localhost.localdomain (176.122.172.82.16clouds.com. [176.122.172.82]) by smtp.gmail.com with ESMTPSA id o86sm1422706pfi.87.2018.02.26.00.27.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Feb 2018 00:27:39 -0800 (PST) From: Alex Shi To: Marc Zyngier , Will Deacon , Ard Biesheuvel , Catalin Marinas , stable@vger.kernel.org, Russell King , linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 50/52] arm: Invalidate icache on prefetch abort outside of user mapping on Cortex-A15 Date: Mon, 26 Feb 2018 16:20:24 +0800 Message-Id: <1519633227-29832-51-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519633227-29832-1-git-send-email-alex.shi@linaro.org> References: <1519633227-29832-1-git-send-email-alex.shi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180226_002752_305275_FE187798 X-CRM114-Status: GOOD ( 11.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc Zyngier ** Not yet queued for inclusion in mainline ** In order to prevent aliasing attacks on the branch predictor, invalidate the icache on Cortex-A15, which has the side effect of invalidating the BTB. This requires ACTLR[0] to be set to 1 (secure operation). Signed-off-by: Marc Zyngier Signed-off-by: Will Deacon Signed-off-by: Alex Shi --- arch/arm/include/asm/cp15.h | 1 + arch/arm/mm/fault.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/arch/arm/include/asm/cp15.h b/arch/arm/include/asm/cp15.h index 0672ddc..b74b174 100644 --- a/arch/arm/include/asm/cp15.h +++ b/arch/arm/include/asm/cp15.h @@ -65,6 +65,7 @@ #define write_sysreg(v, ...) __write_sysreg(v, __VA_ARGS__) #define BPIALL __ACCESS_CP15(c7, 0, c5, 6) +#define ICIALLU __ACCESS_CP15(c7, 0, c5, 0) extern unsigned long cr_alignment; /* defined in entry-armv.S */ diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 17fd0c7..a9c924b 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c @@ -409,6 +409,10 @@ do_pabt_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) case ARM_CPU_PART_CORTEX_A17: write_sysreg(0, BPIALL); break; + + case ARM_CPU_PART_CORTEX_A15: + write_sysreg(0, ICIALLU); + break; } } #endif