Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1231509
| From | Oleg Nesterov <oleg@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: Multiple potential races on vma->vm_flags |
| Date | 2015-09-23 17:40 +0200 |
| Message-ID | <qbUjg-8im-19@gated-at.bofh.it> (permalink) |
| References | (2 earlier) <q635U-4u5-19@gated-at.bofh.it> <q6Ynw-2Kg-25@gated-at.bofh.it> <q75yI-4zn-51@gated-at.bofh.it> <q7a5k-2Ey-17@gated-at.bofh.it> <q7u41-7zp-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 09/11, Kirill A. Shutemov wrote: > > This one is tricky. I *assume* the mm cannot be generally accessible after > mm_users drops to zero, but I'm not entirely sure about it. > procfs? ptrace? Well, all I can say is that proc/ptrace look fine afaics... This is off-topic, but how about the patch below? Different threads can expand different vma's at the same time under read_lock(mmap_sem), so vma_lock_anon_vma() can't help to serialize "locked_vm += grow". Oleg. --- x/mm/mmap.c +++ x/mm/mmap.c @@ -2146,9 +2146,6 @@ static int acct_stack_growth(struct vm_a if (security_vm_enough_memory_mm(mm, grow)) return -ENOMEM; - /* Ok, everything looks good - let it rip */ - if (vma->vm_flags & VM_LOCKED) - mm->locked_vm += grow; vm_stat_account(mm, vma->vm_flags, vma->vm_file, grow); return 0; } @@ -2210,6 +2207,8 @@ int expand_upwards(struct vm_area_struct * against concurrent vma expansions. */ spin_lock(&vma->vm_mm->page_table_lock); + if (vma->vm_flags & VM_LOCKED) + mm->locked_vm += grow; anon_vma_interval_tree_pre_update_vma(vma); vma->vm_end = address; anon_vma_interval_tree_post_update_vma(vma); @@ -2281,6 +2280,8 @@ int expand_downwards(struct vm_area_stru * against concurrent vma expansions. */ spin_lock(&vma->vm_mm->page_table_lock); + if (vma->vm_flags & VM_LOCKED) + mm->locked_vm += grow; anon_vma_interval_tree_pre_update_vma(vma); vma->vm_start = address; vma->vm_pgoff -= grow; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Multiple potential races on vma->vm_flags Oleg Nesterov <oleg@redhat.com> - 2015-09-23 17:40 +0200 Re: Multiple potential races on vma->vm_flags Oleg Nesterov <oleg@redhat.com> - 2015-09-23 17:50 +0200
csiph-web