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: 9240461 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 7B2116077C for ; Wed, 20 Jul 2016 20:27:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6ADD727C26 for ; Wed, 20 Jul 2016 20:27:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D0E327D4D; Wed, 20 Jul 2016 20:27:40 +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 6DD9327C26 for ; Wed, 20 Jul 2016 20:27:38 +0000 (UTC) Received: (qmail 9451 invoked by uid 550); 20 Jul 2016 20:27:31 -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: Reply-To: kernel-hardening@lists.openwall.com Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 9432 invoked from network); 20 Jul 2016 20:27:30 -0000 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=ITmTIZUg51qGQ5MgqBkj5Pl0Ge2+S+Dk7Pq40uFl9MpDRxJ8HmbCnA0pCTzSi1wbiN VFrRbJJ9D21Fskuev1UmWOIfV5Nuv3Ey+qswUy4aCYD1yCNOHl4RL+693unyGqKXDq8C kM1Yj3vAPwuvwqrd1YpxHRmsFpbfJNobiULsFv9Z6F2rZUP6+pYn8CT+ZXo4IWkNDc2B LzfzjetSLs4npyVIjTAYPIi6cPealMnh6PjNvymTwjGyJQXs4XeML44GOd0sSTJz6xaE xq1VCyc7NC/n5fULCecUkMn59lBNhY9e4ib0h1OlxvfWlrrmV8+InSdOBWePU/jBfmlZ iwWw== X-Gm-Message-State: ALyK8tLWYb1Lt07NnrCMTKAXcvNdx8BXnBOLgwej/OaVIWr5dYZXhgaa0USdEfbi4hGL6t/q X-Received: by 10.66.76.38 with SMTP id h6mr9921142paw.79.1469046438655; Wed, 20 Jul 2016 13:27:18 -0700 (PDT) From: Kees Cook To: kernel-hardening@lists.openwall.com Cc: Kees Cook , Laura Abbott , Laura Abbott , Balbir Singh , Daniel Micay , Josh Poimboeuf , Rik van Riel , Casey Schaufler , PaX Team , Brad Spengler , Russell King , Catalin Marinas , Will Deacon , Ard Biesheuvel , Benjamin Herrenschmidt , Michael Ellerman , Tony Luck , Fenghua Yu , "David S. Miller" , x86@kernel.org, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Andy Lutomirski , Borislav Petkov , Mathias Krause , Jan Kara , Vitaly Wool , Andrea Arcangeli , Dmitry Vyukov , linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org 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> Subject: [kernel-hardening] [PATCH v4 01/12] mm: Add is_migrate_cma_page 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) \