From patchwork Thu Dec 10 17:39:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 58234 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp641946lbb; Thu, 10 Dec 2015 09:40:21 -0800 (PST) X-Received: by 10.98.72.152 with SMTP id q24mr8665136pfi.156.1449769221093; Thu, 10 Dec 2015 09:40:21 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5si21508787pas.82.2015.12.10.09.40.20; Thu, 10 Dec 2015 09:40:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752675AbbLJRkU (ORCPT + 2 others); Thu, 10 Dec 2015 12:40:20 -0500 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:51447 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752320AbbLJRkT (ORCPT ); Thu, 10 Dec 2015 12:40:19 -0500 Received: from edgewater-inn.cambridge.arm.com (edgewater-inn.cambridge.arm.com [10.1.203.29]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id tBAHdrWr018785; Thu, 10 Dec 2015 17:39:53 GMT Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 986021AE30A6; Thu, 10 Dec 2015 17:40:00 +0000 (GMT) From: Will Deacon To: linux-arm-kernel@lists.infradead.org Cc: mark.rutland@arm.com, Will Deacon , Subject: [PATCH] arm64: mm: ensure that the zero page is visible to the page table walker Date: Thu, 10 Dec 2015 17:39:59 +0000 Message-Id: <1449769199-31361-1-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org In paging_init, we allocate the zero page, memset it to zero and then point TTBR0 to it in order to avoid speculative fetches through the identity mapping. In order to guarantee that the freshly zeroed page is indeed visible to the page table walker, we need to execute a dsb instruction prior to writing the TTBR. Cc: # v3.14+, for older kernels need to drop the 'ishst' Signed-off-by: Will Deacon --- arch/arm64/mm/mmu.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index c04def90f3e4..c5bd5bca8e3d 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -464,6 +464,9 @@ void __init paging_init(void) empty_zero_page = virt_to_page(zero_page); + /* Ensure the zero page is visible to the page table walker */ + dsb(ishst); + /* * TTBR0 is only used for the identity mapping at this stage. Make it * point to zero page to avoid speculatively fetching new entries.