From patchwork Wed Aug 9 20:07:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tycho Andersen X-Patchwork-Id: 9891893 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 052FC60363 for ; Wed, 9 Aug 2017 20:10:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB87228A56 for ; Wed, 9 Aug 2017 20:10:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E048B28AA9; Wed, 9 Aug 2017 20:10:42 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 21C2128A8D for ; Wed, 9 Aug 2017 20:10:41 +0000 (UTC) Received: (qmail 1590 invoked by uid 550); 9 Aug 2017 20:09:26 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 32361 invoked from network); 9 Aug 2017 20:09:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=docker.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dDubCpTdXyRP//ykVVac16vlV8xA2aewlLZlcd3RNgw=; b=YaVEQvGzwFvFbKG1BPu0fIsfcO8/+yCnULjw/3NMRvy/IALifLR0ayo1vDFKPCcBFf GBXqs+NfQlSmlRF6LT3aystKfLoBBat48ET+HjD3OISKXPnL6yJgdlIR46CEShl3y5rT OGc5hNYbYpNdveL0WJLg6cvTnnHriV77TDVzc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dDubCpTdXyRP//ykVVac16vlV8xA2aewlLZlcd3RNgw=; b=MV2NMXQQv5lkMeN6IZlD77cIOf6svv1uDveB7tnpDfEvn+6WC5v7PBlL580s6fMhNa l6Y0uivlXzOab9m4gG7PSJ/JKRcdnq5B+21NbDQK6K3FhhJY/h2uZtg4hMtVPaYFdvpW eewvWlK3pSkGp78ZAt+P+07OX+s/lSxkoOPXfcjJlSlG1/VMvMyZRPKzL09tlU53jSAx A9T2ApFNIHxxoqUyijDsnGcijyEMTxGFwiZO540LgM12/0yDDWI2MZKPDhMsixPgYQa7 jIsfd/Wt8snK9RZqx6zVryONTF3ZrCCWs/HVIWlAbIin29vxgvW0kMCNbb2rlga+wrfF pEVA== X-Gm-Message-State: AHYfb5ifuAYEVeJPpV/pbceJEG1gAYAuBzfrmwDzIO7kdMisZ4SxwLsT AY/QuToEzNi7NzCY X-Received: by 10.36.159.3 with SMTP id c3mr8736743ite.2.1502309342499; Wed, 09 Aug 2017 13:09:02 -0700 (PDT) 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 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> Subject: [kernel-hardening] [PATCH v5 07/10] arm64/mm: Don't flush the data cache if the page is unmapped by XPFO X-Virus-Scanned: ClamAV using ClamSMTP 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);