Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

Al Viro ac2aca28 ea6fb417

+10 -3
+9 -2
arch/um/include/asm/mmu_context.h
··· 9 9 #include <linux/sched.h> 10 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 13 extern void arch_exit_mmap(struct mm_struct *mm); 14 14 15 15 #define deactivate_mm(tsk,mm) do { } while (0) ··· 23 23 * when the new ->mm is used for the first time. 24 24 */ 25 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 31 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, ··· 39 37 if(next != &init_mm) 40 38 __switch_mm(&next->context.id); 41 39 } 40 + } 41 + 42 + static inline void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) 43 + { 44 + uml_setup_stubs(mm); 42 45 } 43 46 44 47 static inline void enter_lazy_tlb(struct mm_struct *mm,
+1 -1
arch/um/kernel/skas/mmu.c
··· 101 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 106 struct page **pages; 107 107 int err, ret;