From patchwork Mon Nov 27 16:37:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 119745 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp511595qgn; Mon, 27 Nov 2017 08:38:29 -0800 (PST) X-Google-Smtp-Source: AGs4zMYNYgFykugD75lhUMgyVXlkQV1U1WpgDBBZo/UHaTFaYdCVPSnSeJxWk3yQ7s+tIc6LUJpZ X-Received: by 10.98.17.196 with SMTP id 65mr37805955pfr.35.1511800709308; Mon, 27 Nov 2017 08:38:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511800709; cv=none; d=google.com; s=arc-20160816; b=wilcI9ujRpA9JOoUrmEMjKGAttDsNgCFivmPWtcuYTYYDViKIbPbiURVrj3Lpk1bJ0 447yeX5xHxVa3TOIowDyO/mKQCajcDIYgmQmtcfu1C6J5MNamkvzwTVMWVw8S6u+Qwou uSpgleMzP1zVE07xUSTQqCJTapb3/iU1+W3p9GMnMRd9TEP8xl9Rp6QeG5DbH/1sTiox N8SVBSerB5c78as7BPJeHBPuqyjNI4ARD+QR9Ushv/4AokGQ3/4CjfJDwh6qvc94dyfx 9VXh+E5Zfck+QEUBZwk14qoXkQolw4dfyKLMCyGqRljsC36d4D2SfmwQbf+Po/bnENXB HdVg== 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=7LjZBVhpdg4XHClpMJiQcR7J8ohwJ9E1TX6FBckDDWo=; b=Bh+L4vfcBKHJTUm+ctGorQwcLqDOyHwSRgGh8F7X9atYt9vIoAmi27OzaA/HNVjVoC WFxww5cmtIgVibScjkTaC9ILMxwqpoI92JwPTUCDP4gSHk5eYnfVnJj5/fXngfYinwc/ 6/LKSrFt4o1EqFr0z0QC/mYcq72/dwyRr20+DcmJb6XQW8GziahXvDTUywjkY9HS7HIb 6lWFiviNLURP/eljc2TBmgjEXVvq73a3knG/oi2kBJi4vp6qr/DRariBSmYckxOWzMye YhzvLXEFD+h9UoW2As2FDklEI8r4hARp7PpQMHwDV1mpxxBsLBqqazpcqpIcG8/wkPDm S6Ww== 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 w24si2360296plq.696.2017.11.27.08.38.29; Mon, 27 Nov 2017 08:38:29 -0800 (PST) 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 S1753491AbdK0Qi2 (ORCPT + 28 others); Mon, 27 Nov 2017 11:38:28 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:40064 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752930AbdK0Qi0 (ORCPT ); Mon, 27 Nov 2017 11:38:26 -0500 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 298E815A2; Mon, 27 Nov 2017 08:38:26 -0800 (PST) Received: from lakrids.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 7C8403F246; Mon, 27 Nov 2017 08:38:23 -0800 (PST) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: arnd@arndb.de, catalin.marinas@arm.com, cdall@linaro.org, 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, kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, awallis@codeaurora.org Subject: [PATCHv2 01/12] asm-generic: mm_hooks: allow hooks to be overridden individually Date: Mon, 27 Nov 2017 16:37:55 +0000 Message-Id: <20171127163806.31435-2-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171127163806.31435-1-mark.rutland@arm.com> References: <20171127163806.31435-1-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(+) -- 2.11.0 diff --git a/include/asm-generic/mm_hooks.h b/include/asm-generic/mm_hooks.h index ea189d88a3cc..34edf0850d49 100644 --- a/include/asm-generic/mm_hooks.h +++ b/include/asm-generic/mm_hooks.h @@ -7,30 +7,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 */