diff options
Diffstat (limited to 'fs/binfmt_aout.c')
-rw-r--r-- | fs/binfmt_aout.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index 88527492b917..d146e181d10d 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c | |||
@@ -319,24 +319,20 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
319 | goto beyond_if; | 319 | goto beyond_if; |
320 | } | 320 | } |
321 | 321 | ||
322 | down_write(¤t->mm->mmap_sem); | 322 | error = vm_mmap(bprm->file, N_TXTADDR(ex), ex.a_text, |
323 | error = do_mmap(bprm->file, N_TXTADDR(ex), ex.a_text, | ||
324 | PROT_READ | PROT_EXEC, | 323 | PROT_READ | PROT_EXEC, |
325 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, | 324 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, |
326 | fd_offset); | 325 | fd_offset); |
327 | up_write(¤t->mm->mmap_sem); | ||
328 | 326 | ||
329 | if (error != N_TXTADDR(ex)) { | 327 | if (error != N_TXTADDR(ex)) { |
330 | send_sig(SIGKILL, current, 0); | 328 | send_sig(SIGKILL, current, 0); |
331 | return error; | 329 | return error; |
332 | } | 330 | } |
333 | 331 | ||
334 | down_write(¤t->mm->mmap_sem); | 332 | error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data, |
335 | error = do_mmap(bprm->file, N_DATADDR(ex), ex.a_data, | ||
336 | PROT_READ | PROT_WRITE | PROT_EXEC, | 333 | PROT_READ | PROT_WRITE | PROT_EXEC, |
337 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, | 334 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, |
338 | fd_offset + ex.a_text); | 335 | fd_offset + ex.a_text); |
339 | up_write(¤t->mm->mmap_sem); | ||
340 | if (error != N_DATADDR(ex)) { | 336 | if (error != N_DATADDR(ex)) { |
341 | send_sig(SIGKILL, current, 0); | 337 | send_sig(SIGKILL, current, 0); |
342 | return error; | 338 | return error; |
@@ -417,12 +413,10 @@ static int load_aout_library(struct file *file) | |||
417 | goto out; | 413 | goto out; |
418 | } | 414 | } |
419 | /* Now use mmap to map the library into memory. */ | 415 | /* Now use mmap to map the library into memory. */ |
420 | down_write(¤t->mm->mmap_sem); | 416 | error = vm_mmap(file, start_addr, ex.a_text + ex.a_data, |
421 | error = do_mmap(file, start_addr, ex.a_text + ex.a_data, | ||
422 | PROT_READ | PROT_WRITE | PROT_EXEC, | 417 | PROT_READ | PROT_WRITE | PROT_EXEC, |
423 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, | 418 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, |
424 | N_TXTOFF(ex)); | 419 | N_TXTOFF(ex)); |
425 | up_write(¤t->mm->mmap_sem); | ||
426 | retval = error; | 420 | retval = error; |
427 | if (error != start_addr) | 421 | if (error != start_addr) |
428 | goto out; | 422 | goto out; |