Received: by 10.192.165.156 with SMTP id m28csp379248imm; Tue, 17 Apr 2018 11:41:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx48pBxqmi8msid1t26LGffy8D36FbDcuDCuI2ZF3e3R8Q2wc9LaLM30BD18Ah45d254HbBWe X-Received: by 10.101.78.134 with SMTP id b6mr2598542pgs.392.1523990470205; Tue, 17 Apr 2018 11:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523990470; cv=none; d=google.com; s=arc-20160816; b=ov+Nqjde3ax6rxm0dpXmiAEgkGwmZ6krhyEXxil+hlOkORJtTKy2XIbN7MSUfDx0by mC+e0fgTS11XhO+RfdRKJxqhUQ1M+Ft5QPUy3kC7A6lO/wd8b9008IoFwRYAXCwjfqV+ qWQmKWTFqoaNHpszFBykSaf6Lv7DDgmeQ0Elq0gnsQ4TBzoZ5vWIOV3yzE3Bo+0Cazr9 q0Mrx8Wdrx9PPEt/VfHfMPyfNyrVPUtgI61IJwghl66Z7RDyH5ezmqSU+K5nUUw5GI85 pYj80sI3m/va/gM2lhu/G0ZOHq/jTViyuF+MNxBLPUQrWvBDv24XIWYV1nr/tHBJCdVN dS2w== 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 s85si5484701pfk.369.2018.04.17.11.40.56; Tue, 17 Apr 2018 11:41:10 -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 S1753187AbeDQSjW (ORCPT + 99 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(+) 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 */ -- 2.11.0