mm/gup, x86/mm/pkeys: Check VMAs and PTEs for protection keys
[cascardo/linux.git] / include / asm-generic / mm_hooks.h
1 /*
2  * Define generic no-op hooks for arch_dup_mmap, arch_exit_mmap
3  * and arch_unmap to be included in asm-FOO/mmu_context.h for any
4  * arch FOO which doesn't need to hook these.
5  */
6 #ifndef _ASM_GENERIC_MM_HOOKS_H
7 #define _ASM_GENERIC_MM_HOOKS_H
8
9 static inline void arch_dup_mmap(struct mm_struct *oldmm,
10                                  struct mm_struct *mm)
11 {
12 }
13
14 static inline void arch_exit_mmap(struct mm_struct *mm)
15 {
16 }
17
18 static inline void arch_unmap(struct mm_struct *mm,
19                         struct vm_area_struct *vma,
20                         unsigned long start, unsigned long end)
21 {
22 }
23
24 static inline void arch_bprm_mm_init(struct mm_struct *mm,
25                                      struct vm_area_struct *vma)
26 {
27 }
28
29 static inline bool arch_vma_access_permitted(struct vm_area_struct *vma, bool write)
30 {
31         /* by default, allow everything */
32         return true;
33 }
34
35 static inline bool arch_pte_access_permitted(pte_t pte, bool write)
36 {
37         /* by default, allow everything */
38         return true;
39 }
40 #endif  /* _ASM_GENERIC_MM_HOOKS_H */