diff options
author | Michel Lespinasse <walken@google.com> | 2012-12-12 13:52:25 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-12 17:38:35 -0800 |
commit | 4128997b5f0e7ad583a5f3990051b8188b39055c (patch) | |
tree | 239c6c1b6c79fab5b42fd5927614229a57df5de5 /security/Kconfig | |
parent | c95d26c2ffd3931123d6a7a2489530ccbd36da7a (diff) | |
download | blackbird-op-linux-4128997b5f0e7ad583a5f3990051b8188b39055c.tar.gz blackbird-op-linux-4128997b5f0e7ad583a5f3990051b8188b39055c.zip |
mm: protect against concurrent vma expansion
expand_stack() runs with a shared mmap_sem lock. Because of this, there
could be multiple concurrent stack expansions in the same mm, which may
cause problems in the vma gap update code.
I propose to solve this by taking the mm->page_table_lock around such vma
expansions, in order to avoid the concurrency issue. We only have to
worry about concurrent expand_stack() calls here, since we hold a shared
mmap_sem lock and all vma modificaitons other than expand_stack() are done
under an exclusive mmap_sem lock.
I previously tried to achieve the same effect by making sure all growable
vmas in a given mm would share the same anon_vma, which we already lock
here. However this turned out to be difficult - all of the schemes I
tried for refcounting the growable anon_vma and clearing turned out ugly.
So, I'm now proposing only the minimal fix.
The overhead of taking the page table lock during stack expansion is
expected to be small: glibc doesn't use expandable stacks for the threads
it creates, so having multiple growable stacks is actually uncommon and we
don't expect the page table lock to get bounced between threads.
Signed-off-by: Michel Lespinasse <walken@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security/Kconfig')
0 files changed, 0 insertions, 0 deletions