From patchwork Wed Jul 20 20:26:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9240505 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 20FDE6077C for ; Wed, 20 Jul 2016 20:29:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10FC327BF8 for ; Wed, 20 Jul 2016 20:29:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0550427C39; Wed, 20 Jul 2016 20:29:27 +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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 960AA27BF8 for ; Wed, 20 Jul 2016 20:29:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bPy5p-0007r1-8e; Wed, 20 Jul 2016 20:27:45 +0000 Received: from mail-pa0-x22e.google.com ([2607:f8b0:400e:c03::22e]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bPy5j-0007kC-Vc for linux-arm-kernel@lists.infradead.org; Wed, 20 Jul 2016 20:27:40 +0000 Received: by mail-pa0-x22e.google.com with SMTP id ks6so21477508pab.0 for ; Wed, 20 Jul 2016 13:27:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Sd4prIPNoCOHiuhiKXQQa/HX/jqQQ6kV1M9BX//4NuM=; b=c0+Owjx0PGgO0zQpdNrRqPPmHVJ4g1fzglgJkPdlyLcBcXaS7BQ0r60pR0drAr+c5w w+Bku1DxdRg04zyTO8S+QEjY1ko4nDoqRB0Mp+dOEnuPDINtRQjhMGezrEra+ALvwvyv 9HnL6/WWUlHf3CZtNO6iYtjv1EeD4myKzAhqg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Sd4prIPNoCOHiuhiKXQQa/HX/jqQQ6kV1M9BX//4NuM=; b=Wk+KsCIRsmuHxGfV/4Iyp3i4nxlrAaPYFC0OUuMAI4Hjni12H9uTDXs6bmflt+mp5a 1DzN1PfYlTvxkni81RKAChbgRosw12HNQjQXLpcBGCUVtRraOvxCn7wuVx4N9xrErCMl fqr5doBzvjIxrn0ZVu/kHY6ghKw6MV40jCiCN3FOIrpSuy8vBpGI1LvMtR3MbPmNI2fM XGMC8MmuNmm/kAjXX3PVQtAGOXzHpi1RB9cg0k6Snv0oD9DIjAnFLYRrHOi2U8dtnWgv 7qWGqrNCCg4tJ1P0SzSogH9T0iDJRsAbQdhtlOfCjTckbCnyEVoO3L/2BtmbcFgdaDHm NEKQ== X-Gm-Message-State: ALyK8tLoYGnqk53a+dP1iCEMwPGtLCVuUj5cBJKWN6NJ1C5/0OP1K7A7rVjom72ZmML+Pcaq X-Received: by 10.66.76.38 with SMTP id h6mr9921142paw.79.1469046438655; Wed, 20 Jul 2016 13:27:18 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id s89sm6580373pfi.83.2016.07.20.13.27.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2016 13:27:17 -0700 (PDT) From: Kees Cook To: kernel-hardening@lists.openwall.com Subject: [PATCH v4 01/12] mm: Add is_migrate_cma_page Date: Wed, 20 Jul 2016 13:26:56 -0700 Message-Id: <1469046427-12696-2-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1469046427-12696-1-git-send-email-keescook@chromium.org> References: <1469046427-12696-1-git-send-email-keescook@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160720_132740_070089_E2F89C23 X-CRM114-Status: GOOD ( 11.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jan Kara , Benjamin Herrenschmidt , Balbir Singh , Will Deacon , linux-mm@kvack.org, sparclinux@vger.kernel.org, linux-ia64@vger.kernel.org, Christoph Lameter , Andrea Arcangeli , linux-arch@vger.kernel.org, Michael Ellerman , x86@kernel.org, Russell King , Borislav Petkov , Catalin Marinas , PaX Team , Laura Abbott , Mathias Krause , Fenghua Yu , Rik van Riel , Kees Cook , Vitaly Wool , David Rientjes , Tony Luck , Andy Lutomirski , Josh Poimboeuf , Andrew Morton , Dmitry Vyukov , Laura Abbott , linux-arm-kernel@lists.infradead.org, Brad Spengler , Ard Biesheuvel , linux-kernel@vger.kernel.org, Pekka Enberg , Daniel Micay , Casey Schaufler , Joonsoo Kim , linuxppc-dev@lists.ozlabs.org, "David S. Miller" 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: Laura Abbott Code such as hardened user copy[1] needs a way to tell if a page is CMA or not. Add is_migrate_cma_page in a similar way to is_migrate_isolate_page. [1]http://article.gmane.org/gmane.linux.kernel.mm/155238 Signed-off-by: Laura Abbott Signed-off-by: Kees Cook --- include/linux/mmzone.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 02069c23486d..c8478b29f070 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -68,8 +68,10 @@ extern char * const migratetype_names[MIGRATE_TYPES]; #ifdef CONFIG_CMA # define is_migrate_cma(migratetype) unlikely((migratetype) == MIGRATE_CMA) +# define is_migrate_cma_page(_page) (get_pageblock_migratetype(_page) == MIGRATE_CMA) #else # define is_migrate_cma(migratetype) false +# define is_migrate_cma_page(_page) false #endif #define for_each_migratetype_order(order, type) \