diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-02-23 01:37:19 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-20 21:29:50 -0400 |
commit | ac2aca2817ca10ad30f86d0d3caa41ea8cc4f0f0 (patch) | |
tree | d48719c7b748d4bd99aa176fda481b25dbecd1c3 | |
parent | ea6fb41752dda2e450bd8a318c7400f8cfa9111e (diff) |
um: uml_dup_mmap() relies on ->mmap_sem being held, but activate_mm() doesn't hold it
... while calling uml_dup_mmap()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | arch/um/include/asm/mmu_context.h | 11 | ||||
-rw-r--r-- | arch/um/kernel/skas/mmu.c | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/arch/um/include/asm/mmu_context.h b/arch/um/include/asm/mmu_context.h index 591b3d8d7614..aa4a743dc4ab 100644 --- a/arch/um/include/asm/mmu_context.h +++ b/arch/um/include/asm/mmu_context.h | |||
@@ -9,7 +9,7 @@ | |||
9 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
10 | #include <asm/mmu.h> | 10 | #include <asm/mmu.h> |
11 | 11 | ||
12 | extern void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm); | 12 | extern void uml_setup_stubs(struct mm_struct *mm); |
13 | extern void arch_exit_mmap(struct mm_struct *mm); | 13 | extern void arch_exit_mmap(struct mm_struct *mm); |
14 | 14 | ||
15 | #define deactivate_mm(tsk,mm) do { } while (0) | 15 | #define deactivate_mm(tsk,mm) do { } while (0) |
@@ -23,7 +23,9 @@ static inline void activate_mm(struct mm_struct *old, struct mm_struct *new) | |||
23 | * when the new ->mm is used for the first time. | 23 | * when the new ->mm is used for the first time. |
24 | */ | 24 | */ |
25 | __switch_mm(&new->context.id); | 25 | __switch_mm(&new->context.id); |
26 | arch_dup_mmap(old, new); | 26 | down_write(&new->mmap_sem); |
27 | uml_setup_stubs(new); | ||
28 | up_write(&new->mmap_sem); | ||
27 | } | 29 | } |
28 | 30 | ||
29 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | 31 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, |
@@ -39,6 +41,11 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
39 | } | 41 | } |
40 | } | 42 | } |
41 | 43 | ||
44 | static inline void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) | ||
45 | { | ||
46 | uml_setup_stubs(mm); | ||
47 | } | ||
48 | |||
42 | static inline void enter_lazy_tlb(struct mm_struct *mm, | 49 | static inline void enter_lazy_tlb(struct mm_struct *mm, |
43 | struct task_struct *tsk) | 50 | struct task_struct *tsk) |
44 | { | 51 | { |
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c index db2ef422c1b8..4947b319f53a 100644 --- a/arch/um/kernel/skas/mmu.c +++ b/arch/um/kernel/skas/mmu.c | |||
@@ -101,7 +101,7 @@ int init_new_context(struct task_struct *task, struct mm_struct *mm) | |||
101 | return ret; | 101 | return ret; |
102 | } | 102 | } |
103 | 103 | ||
104 | void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) | 104 | void uml_setup_stubs(struct mm_struct *mm) |
105 | { | 105 | { |
106 | struct page **pages; | 106 | struct page **pages; |
107 | int err, ret; | 107 | int err, ret; |