diff options
Diffstat (limited to 'fs/binfmt_elf_fdpic.c')
-rw-r--r-- | fs/binfmt_elf_fdpic.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 9bd5612a8224..d390a0fffc65 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -390,21 +390,17 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm, | |||
390 | (executable_stack == EXSTACK_DEFAULT && VM_STACK_FLAGS & VM_EXEC)) | 390 | (executable_stack == EXSTACK_DEFAULT && VM_STACK_FLAGS & VM_EXEC)) |
391 | stack_prot |= PROT_EXEC; | 391 | stack_prot |= PROT_EXEC; |
392 | 392 | ||
393 | down_write(¤t->mm->mmap_sem); | 393 | current->mm->start_brk = vm_mmap(NULL, 0, stack_size, stack_prot, |
394 | current->mm->start_brk = do_mmap(NULL, 0, stack_size, stack_prot, | ||
395 | MAP_PRIVATE | MAP_ANONYMOUS | | 394 | MAP_PRIVATE | MAP_ANONYMOUS | |
396 | MAP_UNINITIALIZED | MAP_GROWSDOWN, | 395 | MAP_UNINITIALIZED | MAP_GROWSDOWN, |
397 | 0); | 396 | 0); |
398 | 397 | ||
399 | if (IS_ERR_VALUE(current->mm->start_brk)) { | 398 | if (IS_ERR_VALUE(current->mm->start_brk)) { |
400 | up_write(¤t->mm->mmap_sem); | ||
401 | retval = current->mm->start_brk; | 399 | retval = current->mm->start_brk; |
402 | current->mm->start_brk = 0; | 400 | current->mm->start_brk = 0; |
403 | goto error_kill; | 401 | goto error_kill; |
404 | } | 402 | } |
405 | 403 | ||
406 | up_write(¤t->mm->mmap_sem); | ||
407 | |||
408 | current->mm->brk = current->mm->start_brk; | 404 | current->mm->brk = current->mm->start_brk; |
409 | current->mm->context.end_brk = current->mm->start_brk; | 405 | current->mm->context.end_brk = current->mm->start_brk; |
410 | current->mm->context.end_brk += | 406 | current->mm->context.end_brk += |
@@ -955,10 +951,8 @@ static int elf_fdpic_map_file_constdisp_on_uclinux( | |||
955 | if (params->flags & ELF_FDPIC_FLAG_EXECUTABLE) | 951 | if (params->flags & ELF_FDPIC_FLAG_EXECUTABLE) |
956 | mflags |= MAP_EXECUTABLE; | 952 | mflags |= MAP_EXECUTABLE; |
957 | 953 | ||
958 | down_write(&mm->mmap_sem); | 954 | maddr = vm_mmap(NULL, load_addr, top - base, |
959 | maddr = do_mmap(NULL, load_addr, top - base, | ||
960 | PROT_READ | PROT_WRITE | PROT_EXEC, mflags, 0); | 955 | PROT_READ | PROT_WRITE | PROT_EXEC, mflags, 0); |
961 | up_write(&mm->mmap_sem); | ||
962 | if (IS_ERR_VALUE(maddr)) | 956 | if (IS_ERR_VALUE(maddr)) |
963 | return (int) maddr; | 957 | return (int) maddr; |
964 | 958 | ||
@@ -1096,10 +1090,8 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params, | |||
1096 | 1090 | ||
1097 | /* create the mapping */ | 1091 | /* create the mapping */ |
1098 | disp = phdr->p_vaddr & ~PAGE_MASK; | 1092 | disp = phdr->p_vaddr & ~PAGE_MASK; |
1099 | down_write(&mm->mmap_sem); | 1093 | maddr = vm_mmap(file, maddr, phdr->p_memsz + disp, prot, flags, |
1100 | maddr = do_mmap(file, maddr, phdr->p_memsz + disp, prot, flags, | ||
1101 | phdr->p_offset - disp); | 1094 | phdr->p_offset - disp); |
1102 | up_write(&mm->mmap_sem); | ||
1103 | 1095 | ||
1104 | kdebug("mmap[%d] <file> sz=%lx pr=%x fl=%x of=%lx --> %08lx", | 1096 | kdebug("mmap[%d] <file> sz=%lx pr=%x fl=%x of=%lx --> %08lx", |
1105 | loop, phdr->p_memsz + disp, prot, flags, | 1097 | loop, phdr->p_memsz + disp, prot, flags, |
@@ -1143,10 +1135,8 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params, | |||
1143 | unsigned long xmaddr; | 1135 | unsigned long xmaddr; |
1144 | 1136 | ||
1145 | flags |= MAP_FIXED | MAP_ANONYMOUS; | 1137 | flags |= MAP_FIXED | MAP_ANONYMOUS; |
1146 | down_write(&mm->mmap_sem); | 1138 | xmaddr = vm_mmap(NULL, xaddr, excess - excess1, |
1147 | xmaddr = do_mmap(NULL, xaddr, excess - excess1, | ||
1148 | prot, flags, 0); | 1139 | prot, flags, 0); |
1149 | up_write(&mm->mmap_sem); | ||
1150 | 1140 | ||
1151 | kdebug("mmap[%d] <anon>" | 1141 | kdebug("mmap[%d] <anon>" |
1152 | " ad=%lx sz=%lx pr=%x fl=%x of=0 --> %08lx", | 1142 | " ad=%lx sz=%lx pr=%x fl=%x of=0 --> %08lx", |