diff options
author | Marcelo Tosatti <marcelo.tosatti@cyclades.com> | 2005-01-11 16:12:09 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-01-11 16:12:09 -0800 |
commit | 6a424edaddfcd5b68be2e1e641962764b57d7680 (patch) | |
tree | 4b2a8197472ae861ea6595a781c2521dff9087c1 /mm | |
parent | fa6e49a2497cb4298d81c0d384c1ade8bcf1f0a3 (diff) | |
download | history-6a424edaddfcd5b68be2e1e641962764b57d7680.tar.gz |
[PATCH] do_brk() needs mmap_sem write-locked
It seems to be general consensus that its safer to require all do_brk() callers
to grab mmap_sem, and have do_brk to warn otherwise. This is what the following
patch does.
Similar version has been changed to in v2.4.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mmap.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mm/mmap.c b/mm/mmap.c index 9ccd3146bfdcc5..6eeae1d510d76c 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1903,6 +1903,12 @@ unsigned long do_brk(unsigned long addr, unsigned long len) } /* + * mm->mmap_sem is required to protect against another thread + * changing the mappings in case we sleep. + */ + WARN_ON(down_read_trylock(&mm->mmap_sem)); + + /* * Clear old maps. this also does some error checking for us */ munmap_back: |