Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1615334

[RFC 1/9] asm-generic: mm_hooks: allow hooks to be overridden individually

From Mark Rutland <mark.rutland@arm.com>
Newsgroups linux.kernel
Subject [RFC 1/9] asm-generic: mm_hooks: allow hooks to be overridden individually
Date 2017-04-03 17:30 +0200
Message-ID <tsc5A-cE-31@gated-at.bofh.it> (permalink)
References <tsc5A-cE-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <mark.rutland@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de> 
Cc: linux-arch@vger.kernel.org
---
 include/asm-generic/mm_hooks.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/asm-generic/mm_hooks.h b/include/asm-generic/mm_hooks.h
index cc5d9a1..c5a4328 100644
--- a/include/asm-generic/mm_hooks.h
+++ b/include/asm-generic/mm_hooks.h
@@ -6,36 +6,48 @@
 #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
 
+#ifndef arch_pte_access_permitted
 static inline bool arch_pte_access_permitted(pte_t pte, bool write)
 {
 	/* by default, allow everything */
 	return true;
 }
+#endif
 #endif	/* _ASM_GENERIC_MM_HOOKS_H */
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 0/9] ARMv8.3 pointer authentication userspace support Mark Rutland <mark.rutland@arm.com> - 2017-04-03 17:30 +0200
  [RFC 4/9] arm64/cpufeature: detect pointer authentication Mark Rutland <mark.rutland@arm.com> - 2017-04-03 17:30 +0200
  [RFC 8/9] arm64/kvm: context-switch PAC registers Mark Rutland <mark.rutland@arm.com> - 2017-04-03 17:30 +0200
    Re: [RFC 8/9] arm64/kvm: context-switch PAC registers Marc Zyngier <marc.zyngier@arm.com> - 2017-04-07 17:50 +0200
  [RFC 9/9] arm64: docs: document pointer authentication Mark Rutland <mark.rutland@arm.com> - 2017-04-03 17:30 +0200
  [RFC 2/9] arm64: add pointer authentication register bits Mark Rutland <mark.rutland@arm.com> - 2017-04-03 17:30 +0200
  [RFC 7/9] arm64: expose PAC bit positions via ptrace Mark Rutland <mark.rutland@arm.com> - 2017-04-03 17:30 +0200
  [RFC 1/9] asm-generic: mm_hooks: allow hooks to be overridden individually Mark Rutland <mark.rutland@arm.com> - 2017-04-03 17:30 +0200
  [RFC 6/9] arm64: add basic pointer authentication support Mark Rutland <mark.rutland@arm.com> - 2017-04-03 17:30 +0200
  Re: [RFC 0/9] ARMv8.3 pointer authentication userspace support Adam Wallis <awallis@codeaurora.org> - 2017-04-07 17:20 +0200

csiph-web