From patchwork Tue Apr 17 18:37:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 133580 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp5037112ljb; Tue, 17 Apr 2018 11:39:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+fconptjX4s9xzU3azq9aq/Pjdpl+BMmE4/bGoTJCDpZWtgrFmDcg0O0ZR0vxJ/fq1Xq+j X-Received: by 10.99.117.26 with SMTP id q26mr2629134pgc.338.1523990371234; Tue, 17 Apr 2018 11:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523990371; cv=none; d=google.com; s=arc-20160816; b=T8h5KGFRu5mOr5VLjN4/MhVMUy5Ut7OQU3u7TnucxpPVKfy1r02kkXxw5IMyqOXZMm goXT0Q9on+dh1JiV/T3cZkjpBa3/fKYaFvh/nnPSK0+SxBZP2khK9se9oOLMQlJltYg9 WMmhz//DFxbUBVRfPqWt8QRm/+SNhXKnyInEZpdpRF0myZXU65BWsDlVQ3OEeT6QIdjG +dZf1yZTZGbzOCG43x3UPT7iaLrNnCFSTg2jyCUWeJIGY6pswTQ91LcoCAIipYtuDETO Hcp0aD75JEJQN/ntmCZSdgJ1Kh7ELaVSIl2bDriutGUKDuOzkviPAJrs5WXiXa290n5D V2sA== 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=5NyX8p96FaCEcF45M2ds34bhzDARufpfc/JRPjLZ5mU=; b=NSsz8QREHSSQ8r0tT2IAyK7IBcGS62jeu2Ywl19VbMix30uul4uIkjWzX74DW47T+C ghb8hyz14ZE63HKp85So7lyleIZM16BYgtUlNOjP+7gsBCbJsgheC3tz4OCvaKDNca2D LKmjHKyklfz0QQDDxMM9Vt0stOoTsfzMS0hEv+K+/HDjpMGlJGj0ZCQI2TjRkfzC6h/p EABE9GIFZAWi0n6MyUAZrNf9chYR0qcmjNK8233ioZklAnOA2gTpbPraOnHbUPULHBKD B1RTDVPLfQnsIFsuHUwrQyFNgq8ITL06ZEpPOzZ60tupcw1Q3i6gGGIRaP8zyd8lMkDs 43PQ== 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 n4si12077415pgp.558.2018.04.17.11.39.27; Tue, 17 Apr 2018 11:39:31 -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 S1753197AbeDQSjW (ORCPT + 29 others); Tue, 17 Apr 2018 14:39:22 -0400 Received: from foss.arm.com ([217.140.101.70]:47026 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752760AbeDQSiF (ORCPT ); Tue, 17 Apr 2018 14:38:05 -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 3B84215AD; Tue, 17 Apr 2018 11:38:05 -0700 (PDT) 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 B52943F587; Tue, 17 Apr 2018 11:38:02 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: arnd@arndb.de, catalin.marinas@arm.com, cdall@kernel.org, drjones@redhat.com, kvmarm@lists.cs.columbia.edu, linux-arch@vger.kernel.org, marc.zyngier@arm.com, mark.rutland@arm.com, ramana.radhakrishnan@arm.com, suzuki.poulose@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, awallis@codeaurora.org, kernel-hardening@lists.openwall.com Subject: [PATCHv3 06/11] asm-generic: mm_hooks: allow hooks to be overridden individually Date: Tue, 17 Apr 2018 19:37:30 +0100 Message-Id: <20180417183735.56985-7-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180417183735.56985-1-mark.rutland@arm.com> References: <20180417183735.56985-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 Acked-by: Arnd Bergmann diff --git a/include/asm-generic/mm_hooks.h b/include/asm-generic/mm_hooks.h index 8ac4e68a12f0..2b3ee15d3702 100644 --- a/include/asm-generic/mm_hooks.h +++ b/include/asm-generic/mm_hooks.h @@ -7,31 +7,42 @@ #ifndef _ASM_GENERIC_MM_HOOKS_H #define _ASM_GENERIC_MM_HOOKS_H +#ifndef arch_dup_mmap static inline int arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) { return 0; } +#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 */