From patchwork Thu Jan 10 21:09:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khalid Aziz X-Patchwork-Id: 10756893 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3870B13B5 for ; Thu, 10 Jan 2019 21:10:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2658529B4B for ; Thu, 10 Jan 2019 21:10:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19A6B29B8E; Thu, 10 Jan 2019 21:10:53 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9020729B4B for ; Thu, 10 Jan 2019 21:10:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5EAD18E000A; Thu, 10 Jan 2019 16:10:38 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 521FC8E0008; Thu, 10 Jan 2019 16:10:38 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C4318E000A; Thu, 10 Jan 2019 16:10:38 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id E67F08E0008 for ; Thu, 10 Jan 2019 16:10:37 -0500 (EST) Received: by mail-pg1-f197.google.com with SMTP id v72so7060575pgb.10 for ; Thu, 10 Jan 2019 13:10:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:in-reply-to:references; bh=bZUUZyFkbCMprgrasNXmseU+a3iCWM1WQZPOxRn+auM=; b=EnojQBzXPAbaAAIm6xgFbmZl1jRpiXcpCGCDJbO4ApQE8xqFYKPzf0LnkA8fcs1wkd kttpUCtaY7oePe5gtsKHRfUFOBnowcGWsdhe5eYAOocImSXUtdSFkgtlCDqG43LiHiqY LqnR0KE2cLb2LBgmMm63ob4ck1S7niS1WrLdwFIilTF0HfXfBCyPC/Ws3jjQKvi8SkFJ PzAMGuXvQa9EyXrkfJw9D5elhLqay5WbxSLktnZvAPkn5e2URhlvu2NVDiJtVKUHOGSh R6uZmbMQYGi7tZmrt+/+e0T1lAkSuutX0SikbxUGywIg6LEINxeU1DQTvn39MbMzelUN V55A== X-Gm-Message-State: AJcUukf3EUUSE32RNym2LT+zMUykqPLUbWs6BsRXrGVu67L8SpcFyLw8 zn5tyqQN4aaBsf/W4RTwXinNb5HGds4MlGTTeJyw+4PD99sEAkS9+tp7p9R7j/YY5aEfI7XkuX4 h+mB9iPtk7L/DwQ8rnHYO803pCccFmTCOhotct8XktqycloC+s/9AsSP75oAdu2rUtw== X-Received: by 2002:a63:2141:: with SMTP id s1mr8654434pgm.148.1547154637611; Thu, 10 Jan 2019 13:10:37 -0800 (PST) X-Google-Smtp-Source: ALg8bN7cTtpzaiU/Yvv+H04botHBrT3Lj7w6pCOvhek80y/EGRCp5sY+i5LD3NveriqAOF1x7Av/ X-Received: by 2002:a63:2141:: with SMTP id s1mr8654385pgm.148.1547154636587; Thu, 10 Jan 2019 13:10:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547154636; cv=none; d=google.com; s=arc-20160816; b=o6iVPDorXauWpQRzTsw7UyNby6gxqyI3mxYKRlIOKpaWg9oJhmenPvAOs79gJcgJMX z0+XisKWg97HQnkBOssssHMJFj9dDALerWATof48EE5/3/7RavdZ0g6eP39/QX8XxMOV iNT9+RLelXC3Pz7c/AqOdBSjrgIusqH9oHEtrhGB5tnWT5SEPoxiiLeTLVL3+RYUx4VW 0Fngz5cOUk4/qVAy/jipcBMyNHUMCneIxz8LND98uUHRj5ndv0txDCx5RqXs9P7EM87a IOeC4GyfHLrvswShbLARSfNhYcpZhC1u7sXcS4bpyRShmv7REAgaMbGg2SKpZxh2ltUR Q7Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=bZUUZyFkbCMprgrasNXmseU+a3iCWM1WQZPOxRn+auM=; b=FRofqNvwaWbEbSPIys98qVVsVIFO7Mfm3+9wc376Kdv7d59pCqbSs/VUPzgTLLWPfp 4eOiIYe7vVyVGIXf+CziaKGHn3Uj7TW3mDdG22zFj5XmMt5dTYPKEmQXyXH+gh4nnKzB dSZuKBxVCRSMFXu1Sy3DuwA7NqP5ABWv0m+hUXfOskjUfoc+cFSx3vZWQ8Tg9ZqWnjbI K72J4VrNPG+WxPILYeof4Huz47csQ3lPDXXphJLqrH2kh8gHzYy2yawMaNROuxMr6FY0 7YhWTtqzsW56OM83thzbYj/mPdzuwg1ADspUjDBn9z2k8NaTxDutmcXbKNpjL7a+ww8x hzZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=vcWL4IWb; spf=pass (google.com: domain of khalid.aziz@oracle.com designates 156.151.31.85 as permitted sender) smtp.mailfrom=khalid.aziz@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from userp2120.oracle.com (userp2120.oracle.com. [156.151.31.85]) by mx.google.com with ESMTPS id w15si3508564plk.357.2019.01.10.13.10.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 13:10:36 -0800 (PST) Received-SPF: pass (google.com: domain of khalid.aziz@oracle.com designates 156.151.31.85 as permitted sender) client-ip=156.151.31.85; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=vcWL4IWb; spf=pass (google.com: domain of khalid.aziz@oracle.com designates 156.151.31.85 as permitted sender) smtp.mailfrom=khalid.aziz@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0AL8uES192919; Thu, 10 Jan 2019 21:10:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : in-reply-to : references; s=corp-2018-07-02; bh=bZUUZyFkbCMprgrasNXmseU+a3iCWM1WQZPOxRn+auM=; b=vcWL4IWbZwKYO2SXRab+NCyTHIBLpjZHIceUOOe25YQx4ENkJt0k1exSOtes/0a8vZYN 8i8kYPNeIinu/be7AoDq3HqHVwO7DnGY2cyZp0ailH1N0x+XrMtBb6i8etUEhucD3NNB 4PvYZRQCTABPDIyAK6SVpi1ngX5xHoDgc0Y4tHvnJh4wSJNVoj5aw++N1nU7Ka5qe57H vA4iQ9ck7Wjr57REHXLQeKTC2IMnxdS5kX7gGddyuDRwGwj5HuNWqkLxMu0IsYZzwYcD B5360GALRkAG7PSTM225aQeQ3tE5LIYp/o2E8IgOVDAFyYUGXTBSzk29Mhwe50XVADq3 gQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2ptn7r9f42-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Jan 2019 21:10:30 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x0ALAT3Z011932 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Jan 2019 21:10:29 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x0ALASwW021340; Thu, 10 Jan 2019 21:10:28 GMT Received: from concerto.internal (/24.9.64.241) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 10 Jan 2019 13:10:28 -0800 From: Khalid Aziz To: juergh@gmail.com, tycho@tycho.ws, jsteckli@amazon.de, ak@linux.intel.com, torvalds@linux-foundation.org, liran.alon@oracle.com, keescook@google.com, konrad.wilk@oracle.com Cc: Tycho Andersen , deepa.srinivasan@oracle.com, chris.hyser@oracle.com, tyhicks@canonical.com, dwmw@amazon.co.uk, andrew.cooper3@citrix.com, jcm@redhat.com, boris.ostrovsky@oracle.com, kanth.ghatraju@oracle.com, joao.m.martins@oracle.com, jmattson@google.com, pradeep.vincent@oracle.com, john.haxby@oracle.com, tglx@linutronix.de, kirill.shutemov@linux.intel.com, hch@lst.de, steven.sistare@oracle.com, kernel-hardening@lists.openwall.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Khalid Aziz Subject: [RFC PATCH v7 08/16] arm64/mm: disable section/contiguous mappings if XPFO is enabled Date: Thu, 10 Jan 2019 14:09:40 -0700 Message-Id: <3dfdd42afe1749d4f82816f967532643de3a5024.1547153058.git.khalid.aziz@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9132 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901100164 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Tycho Andersen XPFO doesn't support section/contiguous mappings yet, so let's disable it if XPFO is turned on. Thanks to Laura Abbot for the simplification from v5, and Mark Rutland for pointing out we need NO_CONT_MAPPINGS too. CC: linux-arm-kernel@lists.infradead.org Signed-off-by: Tycho Andersen Signed-off-by: Khalid Aziz --- arch/arm64/mm/mmu.c | 2 +- include/linux/xpfo.h | 4 ++++ mm/xpfo.c | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index d1d6601b385d..f4dd27073006 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -451,7 +451,7 @@ static void __init map_mem(pgd_t *pgdp) struct memblock_region *reg; int flags = 0; - if (debug_pagealloc_enabled()) + if (debug_pagealloc_enabled() || xpfo_enabled()) flags = NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; /* diff --git a/include/linux/xpfo.h b/include/linux/xpfo.h index 2682a00ebbcb..0c26836a24e1 100644 --- a/include/linux/xpfo.h +++ b/include/linux/xpfo.h @@ -46,6 +46,8 @@ void xpfo_temp_map(const void *addr, size_t size, void **mapping, void xpfo_temp_unmap(const void *addr, size_t size, void **mapping, size_t mapping_len); +bool xpfo_enabled(void); + #else /* !CONFIG_XPFO */ static inline void xpfo_kmap(void *kaddr, struct page *page) { } @@ -68,6 +70,8 @@ static inline void xpfo_temp_unmap(const void *addr, size_t size, } +static inline bool xpfo_enabled(void) { return false; } + #endif /* CONFIG_XPFO */ #endif /* _LINUX_XPFO_H */ diff --git a/mm/xpfo.c b/mm/xpfo.c index f79075bf7d65..25fba05d01bd 100644 --- a/mm/xpfo.c +++ b/mm/xpfo.c @@ -70,6 +70,12 @@ struct page_ext_operations page_xpfo_ops = { .init = init_xpfo, }; +bool __init xpfo_enabled(void) +{ + return !xpfo_disabled; +} +EXPORT_SYMBOL(xpfo_enabled); + static inline struct xpfo *lookup_xpfo(struct page *page) { struct page_ext *page_ext = lookup_page_ext(page);