diff options
author | Dave Hansen <dave.hansen@linux.intel.com> | 2014-11-18 13:23:50 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-11-19 05:54:13 -0500 |
commit | 62e88b1c00de9cb30d937841ed5debed871070b8 (patch) | |
tree | fe74bed1563012ebbab7a3d4c87caaa25c804593 | |
parent | a1ea1c032b8f8c23d86ef4db6d061527e9417f19 (diff) |
mm: Make arch_unmap()/bprm_mm_init() available to all architectures
The x86 MPX patch set calls arch_unmap() and arch_bprm_mm_init()
from fs/exec.c, so we need at least a stub for them in all
architectures. They are only called under an #ifdef for
CONFIG_MMU=y, so we can at least restict this to architectures
with MMU support.
blackfin/c6x have no MMU support, so do not call arch_unmap().
They also do not include mm_hooks.h or mmu_context.h at all and
do not need to be touched.
s390, um and unicore32 do not use asm-generic/mm_hooks.h, so got
their own arch_unmap() versions. (I also moved um's
arch_dup_mmap() to be closer to the other mm_hooks.h functions).
xtensa only includes mm_hooks when MMU=y, which should be fine
since arch_unmap() is called only from MMU=y code.
For the rest, we use the stub copies of these functions in
asm-generic/mm_hook.h.
I cross compiled defconfigs for cris (to check NOMMU) and s390
to make sure that this works. I also checked a 64-bit build
of UML and all my normal x86 builds including PARAVIRT on and
off.
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Dave Hansen <dave@sr71.net>
Cc: linux-arch@vger.kernel.org
Cc: x86@kernel.org
Link: http://lkml.kernel.org/r/20141118182350.8B4AA2C2@viggo.jf.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/s390/include/asm/mmu_context.h | 11 | ||||
-rw-r--r-- | arch/um/include/asm/mmu_context.h | 24 | ||||
-rw-r--r-- | arch/unicore32/include/asm/mmu_context.h | 11 | ||||
-rw-r--r-- | include/asm-generic/mm_hooks.h | 17 | ||||
-rw-r--r-- | include/asm-generic/mmu_context.h | 6 |
5 files changed, 55 insertions, 14 deletions
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h index 3815bfea1b2d..f49b71954654 100644 --- a/arch/s390/include/asm/mmu_context.h +++ b/arch/s390/include/asm/mmu_context.h | |||
@@ -120,4 +120,15 @@ static inline void arch_exit_mmap(struct mm_struct *mm) | |||
120 | { | 120 | { |
121 | } | 121 | } |
122 | 122 | ||
123 | static inline void arch_unmap(struct mm_struct *mm, | ||
124 | struct vm_area_struct *vma, | ||
125 | unsigned long start, unsigned long end) | ||
126 | { | ||
127 | } | ||
128 | |||
129 | static inline void arch_bprm_mm_init(struct mm_struct *mm, | ||
130 | struct vm_area_struct *vma) | ||
131 | { | ||
132 | } | ||
133 | |||
123 | #endif /* __S390_MMU_CONTEXT_H */ | 134 | #endif /* __S390_MMU_CONTEXT_H */ |
diff --git a/arch/um/include/asm/mmu_context.h b/arch/um/include/asm/mmu_context.h index aa4a743dc4ab..941527e507f7 100644 --- a/arch/um/include/asm/mmu_context.h +++ b/arch/um/include/asm/mmu_context.h | |||
@@ -10,7 +10,26 @@ | |||
10 | #include <asm/mmu.h> | 10 | #include <asm/mmu.h> |
11 | 11 | ||
12 | extern void uml_setup_stubs(struct mm_struct *mm); | 12 | extern void uml_setup_stubs(struct mm_struct *mm); |
13 | /* | ||
14 | * Needed since we do not use the asm-generic/mm_hooks.h: | ||
15 | */ | ||
16 | static inline void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) | ||
17 | { | ||
18 | uml_setup_stubs(mm); | ||
19 | } | ||
13 | extern void arch_exit_mmap(struct mm_struct *mm); | 20 | extern void arch_exit_mmap(struct mm_struct *mm); |
21 | static inline void arch_unmap(struct mm_struct *mm, | ||
22 | struct vm_area_struct *vma, | ||
23 | unsigned long start, unsigned long end) | ||
24 | { | ||
25 | } | ||
26 | static inline void arch_bprm_mm_init(struct mm_struct *mm, | ||
27 | struct vm_area_struct *vma) | ||
28 | { | ||
29 | } | ||
30 | /* | ||
31 | * end asm-generic/mm_hooks.h functions | ||
32 | */ | ||
14 | 33 | ||
15 | #define deactivate_mm(tsk,mm) do { } while (0) | 34 | #define deactivate_mm(tsk,mm) do { } while (0) |
16 | 35 | ||
@@ -41,11 +60,6 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
41 | } | 60 | } |
42 | } | 61 | } |
43 | 62 | ||
44 | static inline void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) | ||
45 | { | ||
46 | uml_setup_stubs(mm); | ||
47 | } | ||
48 | |||
49 | static inline void enter_lazy_tlb(struct mm_struct *mm, | 63 | static inline void enter_lazy_tlb(struct mm_struct *mm, |
50 | struct task_struct *tsk) | 64 | struct task_struct *tsk) |
51 | { | 65 | { |
diff --git a/arch/unicore32/include/asm/mmu_context.h b/arch/unicore32/include/asm/mmu_context.h index ef470a7a3d0f..1cb5220afaf9 100644 --- a/arch/unicore32/include/asm/mmu_context.h +++ b/arch/unicore32/include/asm/mmu_context.h | |||
@@ -86,4 +86,15 @@ static inline void arch_dup_mmap(struct mm_struct *oldmm, | |||
86 | { | 86 | { |
87 | } | 87 | } |
88 | 88 | ||
89 | static inline void arch_unmap(struct mm_struct *mm, | ||
90 | struct vm_area_struct *vma, | ||
91 | unsigned long start, unsigned long end) | ||
92 | { | ||
93 | } | ||
94 | |||
95 | static inline void arch_bprm_mm_init(struct mm_struct *mm, | ||
96 | struct vm_area_struct *vma) | ||
97 | { | ||
98 | } | ||
99 | |||
89 | #endif | 100 | #endif |
diff --git a/include/asm-generic/mm_hooks.h b/include/asm-generic/mm_hooks.h index 67dea8123683..866aa461efa5 100644 --- a/include/asm-generic/mm_hooks.h +++ b/include/asm-generic/mm_hooks.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Define generic no-op hooks for arch_dup_mmap and arch_exit_mmap, to | 2 | * Define generic no-op hooks for arch_dup_mmap, arch_exit_mmap |
3 | * be included in asm-FOO/mmu_context.h for any arch FOO which doesn't | 3 | * and arch_unmap to be included in asm-FOO/mmu_context.h for any |
4 | * need to hook these. | 4 | * arch FOO which doesn't need to hook these. |
5 | */ | 5 | */ |
6 | #ifndef _ASM_GENERIC_MM_HOOKS_H | 6 | #ifndef _ASM_GENERIC_MM_HOOKS_H |
7 | #define _ASM_GENERIC_MM_HOOKS_H | 7 | #define _ASM_GENERIC_MM_HOOKS_H |
@@ -15,4 +15,15 @@ static inline void arch_exit_mmap(struct mm_struct *mm) | |||
15 | { | 15 | { |
16 | } | 16 | } |
17 | 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 | |||
18 | #endif /* _ASM_GENERIC_MM_HOOKS_H */ | 29 | #endif /* _ASM_GENERIC_MM_HOOKS_H */ |
diff --git a/include/asm-generic/mmu_context.h b/include/asm-generic/mmu_context.h index aa2d8ba35b20..1f2a8f9c9264 100644 --- a/include/asm-generic/mmu_context.h +++ b/include/asm-generic/mmu_context.h | |||
@@ -47,10 +47,4 @@ static inline void arch_bprm_mm_init(struct mm_struct *mm, | |||
47 | { | 47 | { |
48 | } | 48 | } |
49 | 49 | ||
50 | static inline void arch_unmap(struct mm_struct *mm, | ||
51 | struct vm_area_struct *vma, | ||
52 | unsigned long start, unsigned long end) | ||
53 | { | ||
54 | } | ||
55 | |||
56 | #endif /* __ASM_GENERIC_MMU_CONTEXT_H */ | 50 | #endif /* __ASM_GENERIC_MMU_CONTEXT_H */ |