diff options
Diffstat (limited to 'arch/x86/ia32/ia32_aout.c')
-rw-r--r-- | arch/x86/ia32/ia32_aout.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c index d511d951a052..07b3a68d2d29 100644 --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c | |||
@@ -119,9 +119,7 @@ static void set_brk(unsigned long start, unsigned long end) | |||
119 | end = PAGE_ALIGN(end); | 119 | end = PAGE_ALIGN(end); |
120 | if (end <= start) | 120 | if (end <= start) |
121 | return; | 121 | return; |
122 | down_write(¤t->mm->mmap_sem); | 122 | vm_brk(start, end - start); |
123 | do_brk(start, end - start); | ||
124 | up_write(¤t->mm->mmap_sem); | ||
125 | } | 123 | } |
126 | 124 | ||
127 | #ifdef CORE_DUMP | 125 | #ifdef CORE_DUMP |
@@ -296,8 +294,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
296 | 294 | ||
297 | /* OK, This is the point of no return */ | 295 | /* OK, This is the point of no return */ |
298 | set_personality(PER_LINUX); | 296 | set_personality(PER_LINUX); |
299 | set_thread_flag(TIF_IA32); | 297 | set_personality_ia32(false); |
300 | current->mm->context.ia32_compat = 1; | ||
301 | 298 | ||
302 | setup_new_exec(bprm); | 299 | setup_new_exec(bprm); |
303 | 300 | ||
@@ -332,9 +329,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
332 | pos = 32; | 329 | pos = 32; |
333 | map_size = ex.a_text+ex.a_data; | 330 | map_size = ex.a_text+ex.a_data; |
334 | 331 | ||
335 | down_write(¤t->mm->mmap_sem); | 332 | error = vm_brk(text_addr & PAGE_MASK, map_size); |
336 | error = do_brk(text_addr & PAGE_MASK, map_size); | ||
337 | up_write(¤t->mm->mmap_sem); | ||
338 | 333 | ||
339 | if (error != (text_addr & PAGE_MASK)) { | 334 | if (error != (text_addr & PAGE_MASK)) { |
340 | send_sig(SIGKILL, current, 0); | 335 | send_sig(SIGKILL, current, 0); |
@@ -373,9 +368,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
373 | if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) { | 368 | if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) { |
374 | loff_t pos = fd_offset; | 369 | loff_t pos = fd_offset; |
375 | 370 | ||
376 | down_write(¤t->mm->mmap_sem); | 371 | vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); |
377 | do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); | ||
378 | up_write(¤t->mm->mmap_sem); | ||
379 | bprm->file->f_op->read(bprm->file, | 372 | bprm->file->f_op->read(bprm->file, |
380 | (char __user *)N_TXTADDR(ex), | 373 | (char __user *)N_TXTADDR(ex), |
381 | ex.a_text+ex.a_data, &pos); | 374 | ex.a_text+ex.a_data, &pos); |
@@ -385,26 +378,22 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
385 | goto beyond_if; | 378 | goto beyond_if; |
386 | } | 379 | } |
387 | 380 | ||
388 | down_write(¤t->mm->mmap_sem); | 381 | error = vm_mmap(bprm->file, N_TXTADDR(ex), ex.a_text, |
389 | error = do_mmap(bprm->file, N_TXTADDR(ex), ex.a_text, | ||
390 | PROT_READ | PROT_EXEC, | 382 | PROT_READ | PROT_EXEC, |
391 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | | 383 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | |
392 | MAP_EXECUTABLE | MAP_32BIT, | 384 | MAP_EXECUTABLE | MAP_32BIT, |
393 | fd_offset); | 385 | fd_offset); |
394 | up_write(¤t->mm->mmap_sem); | ||
395 | 386 | ||
396 | if (error != N_TXTADDR(ex)) { | 387 | if (error != N_TXTADDR(ex)) { |
397 | send_sig(SIGKILL, current, 0); | 388 | send_sig(SIGKILL, current, 0); |
398 | return error; | 389 | return error; |
399 | } | 390 | } |
400 | 391 | ||
401 | down_write(¤t->mm->mmap_sem); | 392 | error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data, |
402 | error = do_mmap(bprm->file, N_DATADDR(ex), ex.a_data, | ||
403 | PROT_READ | PROT_WRITE | PROT_EXEC, | 393 | PROT_READ | PROT_WRITE | PROT_EXEC, |
404 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | | 394 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | |
405 | MAP_EXECUTABLE | MAP_32BIT, | 395 | MAP_EXECUTABLE | MAP_32BIT, |
406 | fd_offset + ex.a_text); | 396 | fd_offset + ex.a_text); |
407 | up_write(¤t->mm->mmap_sem); | ||
408 | if (error != N_DATADDR(ex)) { | 397 | if (error != N_DATADDR(ex)) { |
409 | send_sig(SIGKILL, current, 0); | 398 | send_sig(SIGKILL, current, 0); |
410 | return error; | 399 | return error; |
@@ -476,9 +465,7 @@ static int load_aout_library(struct file *file) | |||
476 | error_time = jiffies; | 465 | error_time = jiffies; |
477 | } | 466 | } |
478 | #endif | 467 | #endif |
479 | down_write(¤t->mm->mmap_sem); | 468 | vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); |
480 | do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); | ||
481 | up_write(¤t->mm->mmap_sem); | ||
482 | 469 | ||
483 | file->f_op->read(file, (char __user *)start_addr, | 470 | file->f_op->read(file, (char __user *)start_addr, |
484 | ex.a_text + ex.a_data, &pos); | 471 | ex.a_text + ex.a_data, &pos); |
@@ -490,12 +477,10 @@ static int load_aout_library(struct file *file) | |||
490 | goto out; | 477 | goto out; |
491 | } | 478 | } |
492 | /* Now use mmap to map the library into memory. */ | 479 | /* Now use mmap to map the library into memory. */ |
493 | down_write(¤t->mm->mmap_sem); | 480 | error = vm_mmap(file, start_addr, ex.a_text + ex.a_data, |
494 | error = do_mmap(file, start_addr, ex.a_text + ex.a_data, | ||
495 | PROT_READ | PROT_WRITE | PROT_EXEC, | 481 | PROT_READ | PROT_WRITE | PROT_EXEC, |
496 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_32BIT, | 482 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_32BIT, |
497 | N_TXTOFF(ex)); | 483 | N_TXTOFF(ex)); |
498 | up_write(¤t->mm->mmap_sem); | ||
499 | retval = error; | 484 | retval = error; |
500 | if (error != start_addr) | 485 | if (error != start_addr) |
501 | goto out; | 486 | goto out; |
@@ -503,9 +488,7 @@ static int load_aout_library(struct file *file) | |||
503 | len = PAGE_ALIGN(ex.a_text + ex.a_data); | 488 | len = PAGE_ALIGN(ex.a_text + ex.a_data); |
504 | bss = ex.a_text + ex.a_data + ex.a_bss; | 489 | bss = ex.a_text + ex.a_data + ex.a_bss; |
505 | if (bss > len) { | 490 | if (bss > len) { |
506 | down_write(¤t->mm->mmap_sem); | 491 | error = vm_brk(start_addr + len, bss - len); |
507 | error = do_brk(start_addr + len, bss - len); | ||
508 | up_write(¤t->mm->mmap_sem); | ||
509 | retval = error; | 492 | retval = error; |
510 | if (error != start_addr + len) | 493 | if (error != start_addr + len) |
511 | goto out; | 494 | goto out; |