Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752192AbdHIUJG (ORCPT ); Wed, 9 Aug 2017 16:09:06 -0400 Received: from mail-it0-f41.google.com ([209.85.214.41]:38236 "EHLO mail-it0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751890AbdHIUJD (ORCPT ); Wed, 9 Aug 2017 16:09:03 -0400 From: Tycho Andersen To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, kernel-hardening@lists.openwall.com, Marco Benatto , Juerg Haefliger , Juerg Haefliger Subject: [PATCH v5 07/10] arm64/mm: Don't flush the data cache if the page is unmapped by XPFO Date: Wed, 9 Aug 2017 14:07:52 -0600 Message-Id: <20170809200755.11234-8-tycho@docker.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170809200755.11234-1-tycho@docker.com> References: <20170809200755.11234-1-tycho@docker.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1113 Lines: 36 From: Juerg Haefliger If the page is unmapped by XPFO, a data cache flush results in a fatal page fault. So don't flush in that case. Signed-off-by: Juerg Haefliger Tested-by: Tycho Andersen --- arch/arm64/mm/flush.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index 21a8d828cbf4..e17a063b2df2 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -30,7 +31,9 @@ void sync_icache_aliases(void *kaddr, unsigned long len) unsigned long addr = (unsigned long)kaddr; if (icache_is_aliasing()) { - __clean_dcache_area_pou(kaddr, len); + /* Don't flush if the page is unmapped by XPFO */ + if (!xpfo_page_is_unmapped(virt_to_page(kaddr))) + __clean_dcache_area_pou(kaddr, len); __flush_icache_all(); } else { flush_icache_range(addr, addr + len); -- 2.11.0