summaryrefslogtreecommitdiff
path: root/fs/binfmt_elf.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-11 16:43:28 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-11 16:43:28 -0800
commit1eb0b69c1064c65b32014c8392e6d076c23dc57c (patch)
tree1ba174d2f08eb78ed65f569995e62d694e6a3288 /fs/binfmt_elf.c
parent8904925c10bcd5adc582bd1e4ec3d7f9e13652b2 (diff)
parentbf2efbc58504f0ab67b8f52e820a8287d0015cbc (diff)
Merge bk://gkernel.bkbits.net/libata-2.6
into ppc970.osdl.org:/home/torvalds/v2.6/linux
Diffstat (limited to 'fs/binfmt_elf.c')
-rw-r--r--fs/binfmt_elf.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index a66bc8df6d6f..6eb6971bdee2 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -88,7 +88,10 @@ static int set_brk(unsigned long start, unsigned long end)
start = ELF_PAGEALIGN(start);
end = ELF_PAGEALIGN(end);
if (end > start) {
- unsigned long addr = do_brk(start, end - start);
+ unsigned long addr;
+ down_write(&current->mm->mmap_sem);
+ addr = do_brk(start, end - start);
+ up_write(&current->mm->mmap_sem);
if (BAD_ADDR(addr))
return addr;
}
@@ -409,7 +412,9 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex,
/* Map the last of the bss segment */
if (last_bss > elf_bss) {
+ down_write(&current->mm->mmap_sem);
error = do_brk(elf_bss, last_bss - elf_bss);
+ up_write(&current->mm->mmap_sem);
if (BAD_ADDR(error))
goto out_close;
}
@@ -449,7 +454,9 @@ static unsigned long load_aout_interp(struct exec * interp_ex,
goto out;
}
+ down_write(&current->mm->mmap_sem);
do_brk(0, text_data);
+ up_write(&current->mm->mmap_sem);
if (!interpreter->f_op || !interpreter->f_op->read)
goto out;
if (interpreter->f_op->read(interpreter, addr, text_data, &offset) < 0)
@@ -457,8 +464,11 @@ static unsigned long load_aout_interp(struct exec * interp_ex,
flush_icache_range((unsigned long)addr,
(unsigned long)addr + text_data);
+
+ down_write(&current->mm->mmap_sem);
do_brk(ELF_PAGESTART(text_data + ELF_MIN_ALIGN - 1),
interp_ex->a_bss);
+ up_write(&current->mm->mmap_sem);
elf_entry = interp_ex->a_entry;
out: