From patchwork Wed Jul 19 16:01:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 108309 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp1014547obm; Wed, 19 Jul 2017 09:05:24 -0700 (PDT) X-Received: by 10.101.83.138 with SMTP id x10mr565395pgq.201.1500480324221; Wed, 19 Jul 2017 09:05:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500480324; cv=none; d=google.com; s=arc-20160816; b=hZ8wXIKf+Rn8TUw3rWYa1MS+ouqg2w1q+byCFHUE9erh0Yf4ot5S6QMRgERWhTeAM7 MScoC7YoweopGwSYYoNdfGa2tagtt2dOA/c8v6eExZId5UeqwKywFfl+8M8rdjsv5fmp fojwpyNxrnE29zUmzReTcYnBDerkDz75Y0uTULNY3RaQFP9tWgJXxDakZ8he5iITP4Ym J9rtm4CDgGiZ9O+uBRIsmMkxgo0dcEo7CY4TKIKPvQYENrWRE9Q6NUbYPAgb0MVRw4OR ooBOmA/LW4ps0UBLstIQRzL5AaNjaVZUv74NVfJvlcrEAnU3cFN6n1sYWkBj/eNRZeBr bKLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=roL+YgoW24A8JFl1VfyyIeqSdXUCvcKCU+kvZdYPqG4=; b=gOjYHKjwIvoig0JjB9Yf7LIlwiV3yj5Gv9R/wbVBFtpm0Spg9HY6Pw+hV22TDlGlaF 0osOR285fal6KDIMyDPRH40kmXYcCXWFIEBgjChxZEZ8elxFkCb5eLK4VVd3wDEMQMq1 VCiZxr2cNLx9ijU680hCU9Fvp26oCCpovsRnjbuMaVecfp2QOfxERG+B3HaAtlNqqeZO EExsLWWWbogn1lDyclc2B9XfaEnpTGrEk+JDHSLaB+YAF1JL2L8tW//XIvvR8Uvahtph nFCFkwI2A7cew2capOu7bNYySrksv7Z6Hy8kUSJ9AeW0ce82hDlwxWFGcWztaKuE4zjs IKuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u80si248889pfk.346.2017.07.19.09.05.23; Wed, 19 Jul 2017 09:05:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933151AbdGSQFV (ORCPT + 25 others); Wed, 19 Jul 2017 12:05:21 -0400 Received: from foss.arm.com ([217.140.101.70]:42240 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932661AbdGSQCo (ORCPT ); Wed, 19 Jul 2017 12:02:44 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 727FD15B2; Wed, 19 Jul 2017 09:02:44 -0700 (PDT) Received: from leverpostej.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 19E993F577; Wed, 19 Jul 2017 09:02:41 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: arnd@arndb.de, catalin.marinas@arm.com, christoffer.dall@linaro.org, Dave.Martin@arm.com, jiong.wang@arm.com, kvmarm@lists.cs.columbia.edu, linux-arch@vger.kernel.org, marc.zyngier@arm.com, mark.rutland@arm.com, suzuki.poulose@arm.com, will.deacon@arm.com, yao.qi@arm.com, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: [PATCH 02/11] asm-generic: mm_hooks: allow hooks to be overridden individually Date: Wed, 19 Jul 2017 17:01:23 +0100 Message-Id: <1500480092-28480-3-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1500480092-28480-1-git-send-email-mark.rutland@arm.com> References: <1500480092-28480-1-git-send-email-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, an architecture must either implement all of the mm hooks itself, or use all of those provided by the asm-generic implementation. When an architecture only needs to override a single hook, it must copy the stub implementations from the asm-generic version. To avoid this repetition, allow each hook to be overridden indiviually, by placing each under an #ifndef block. As architectures providing their own hooks can't include this file today, this shouldn't adversely affect any existing hooks. Signed-off-by: Mark Rutland Cc: Arnd Bergmann Cc: linux-arch@vger.kernel.org --- include/asm-generic/mm_hooks.h | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 1.9.1 diff --git a/include/asm-generic/mm_hooks.h b/include/asm-generic/mm_hooks.h index 41e5b67..b4bf1b8 100644 --- a/include/asm-generic/mm_hooks.h +++ b/include/asm-generic/mm_hooks.h @@ -6,30 +6,41 @@ #ifndef _ASM_GENERIC_MM_HOOKS_H #define _ASM_GENERIC_MM_HOOKS_H +#ifndef arch_dup_mmap static inline void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) { } +#endif +#ifndef arch_exit_mmap static inline void arch_exit_mmap(struct mm_struct *mm) { } +#endif +#ifndef arch_unmap static inline void arch_unmap(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long start, unsigned long end) { } +#endif +#ifndef arch_bprm_mm_init static inline void arch_bprm_mm_init(struct mm_struct *mm, struct vm_area_struct *vma) { } +#endif +#ifndef arch_vma_access_permitted static inline bool arch_vma_access_permitted(struct vm_area_struct *vma, bool write, bool execute, bool foreign) { /* by default, allow everything */ return true; } +#endif + #endif /* _ASM_GENERIC_MM_HOOKS_H */