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: 650876 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3rvpP76pTgz9t0P for ; Thu, 21 Jul 2016 06:27:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b=c0+Owjx0; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755030AbcGTU1V (ORCPT ); Wed, 20 Jul 2016 16:27:21 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:36669 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754880AbcGTU1T (ORCPT ); Wed, 20 Jul 2016 16:27:19 -0400 Received: by mail-pa0-f42.google.com with SMTP id pp5so21350609pac.3 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=HWyXnpvdWoS9XZZBK1WpM/gjA27lUqQ4GBrK4wbWpjkFEnM7frvJz/zZCrQS5KdYtv 7Bhb4h0L4NRGZVK/UdMayGoOPoZj4UsPdqk7lREbOhZbme7xHD9pgX4DD3DoIu3cOKVc ajra9Y28X9PoMOsWLyEuhR1ZeN95EAfELpdcPM2jWFcvYlTB4acUJbSSCwvwk33X1pUM o01pUKDnp/egRWrdFut0eYubYNqdbjaZcn0Uhd1+WOFwD78ZjkhcvE+FMbT/2qvfcBMc DhiMmgusUkDU7SIE1mWAteOnkc+JbNluxkoP64EteujT4I9dLjV6OA4imS9cvIehvslx NWeA== X-Gm-Message-State: ALyK8tJVxh7eb25MZyjv8bdZYm+ApUs1uTOoYN6VdPPxroljjcNNAp/VhY7uXWJslohDoqC1 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 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 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> Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org 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) \