diff options
Diffstat (limited to 'arch/sparc/kernel/sys_sparc_64.c')
-rw-r--r-- | arch/sparc/kernel/sys_sparc_64.c | 50 |
1 files changed, 13 insertions, 37 deletions
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c index e2d102447a43..cfa0e19abe3b 100644 --- a/arch/sparc/kernel/sys_sparc_64.c +++ b/arch/sparc/kernel/sys_sparc_64.c | |||
@@ -317,10 +317,14 @@ bottomup: | |||
317 | unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags) | 317 | unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags) |
318 | { | 318 | { |
319 | unsigned long align_goal, addr = -ENOMEM; | 319 | unsigned long align_goal, addr = -ENOMEM; |
320 | unsigned long (*get_area)(struct file *, unsigned long, | ||
321 | unsigned long, unsigned long, unsigned long); | ||
322 | |||
323 | get_area = current->mm->get_unmapped_area; | ||
320 | 324 | ||
321 | if (flags & MAP_FIXED) { | 325 | if (flags & MAP_FIXED) { |
322 | /* Ok, don't mess with it. */ | 326 | /* Ok, don't mess with it. */ |
323 | return get_unmapped_area(NULL, orig_addr, len, pgoff, flags); | 327 | return get_area(NULL, orig_addr, len, pgoff, flags); |
324 | } | 328 | } |
325 | flags &= ~MAP_SHARED; | 329 | flags &= ~MAP_SHARED; |
326 | 330 | ||
@@ -333,7 +337,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u | |||
333 | align_goal = (64UL * 1024); | 337 | align_goal = (64UL * 1024); |
334 | 338 | ||
335 | do { | 339 | do { |
336 | addr = get_unmapped_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags); | 340 | addr = get_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags); |
337 | if (!(addr & ~PAGE_MASK)) { | 341 | if (!(addr & ~PAGE_MASK)) { |
338 | addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL); | 342 | addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL); |
339 | break; | 343 | break; |
@@ -351,7 +355,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u | |||
351 | * be obtained. | 355 | * be obtained. |
352 | */ | 356 | */ |
353 | if (addr & ~PAGE_MASK) | 357 | if (addr & ~PAGE_MASK) |
354 | addr = get_unmapped_area(NULL, orig_addr, len, pgoff, flags); | 358 | addr = get_area(NULL, orig_addr, len, pgoff, flags); |
355 | 359 | ||
356 | return addr; | 360 | return addr; |
357 | } | 361 | } |
@@ -399,18 +403,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm) | |||
399 | } | 403 | } |
400 | } | 404 | } |
401 | 405 | ||
402 | SYSCALL_DEFINE1(sparc_brk, unsigned long, brk) | ||
403 | { | ||
404 | /* People could try to be nasty and use ta 0x6d in 32bit programs */ | ||
405 | if (test_thread_flag(TIF_32BIT) && brk >= STACK_TOP32) | ||
406 | return current->mm->brk; | ||
407 | |||
408 | if (unlikely(straddles_64bit_va_hole(current->mm->brk, brk))) | ||
409 | return current->mm->brk; | ||
410 | |||
411 | return sys_brk(brk); | ||
412 | } | ||
413 | |||
414 | /* | 406 | /* |
415 | * sys_pipe() is the normal C calling standard for creating | 407 | * sys_pipe() is the normal C calling standard for creating |
416 | * a pipe. It's not the way unix traditionally does this, though. | 408 | * a pipe. It's not the way unix traditionally does this, though. |
@@ -568,23 +560,13 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, | |||
568 | unsigned long, prot, unsigned long, flags, unsigned long, fd, | 560 | unsigned long, prot, unsigned long, flags, unsigned long, fd, |
569 | unsigned long, off) | 561 | unsigned long, off) |
570 | { | 562 | { |
571 | struct file * file = NULL; | 563 | unsigned long retval = -EINVAL; |
572 | unsigned long retval = -EBADF; | ||
573 | |||
574 | if (!(flags & MAP_ANONYMOUS)) { | ||
575 | file = fget(fd); | ||
576 | if (!file) | ||
577 | goto out; | ||
578 | } | ||
579 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
580 | len = PAGE_ALIGN(len); | ||
581 | 564 | ||
582 | down_write(¤t->mm->mmap_sem); | 565 | if ((off + PAGE_ALIGN(len)) < off) |
583 | retval = do_mmap(file, addr, len, prot, flags, off); | 566 | goto out; |
584 | up_write(¤t->mm->mmap_sem); | 567 | if (off & ~PAGE_MASK) |
585 | 568 | goto out; | |
586 | if (file) | 569 | retval = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); |
587 | fput(file); | ||
588 | out: | 570 | out: |
589 | return retval; | 571 | return retval; |
590 | } | 572 | } |
@@ -614,12 +596,6 @@ SYSCALL_DEFINE5(64_mremap, unsigned long, addr, unsigned long, old_len, | |||
614 | 596 | ||
615 | if (test_thread_flag(TIF_32BIT)) | 597 | if (test_thread_flag(TIF_32BIT)) |
616 | goto out; | 598 | goto out; |
617 | if (unlikely(new_len >= VA_EXCLUDE_START)) | ||
618 | goto out; | ||
619 | if (unlikely(sparc_mmap_check(addr, old_len))) | ||
620 | goto out; | ||
621 | if (unlikely(sparc_mmap_check(new_addr, new_len))) | ||
622 | goto out; | ||
623 | 599 | ||
624 | down_write(¤t->mm->mmap_sem); | 600 | down_write(¤t->mm->mmap_sem); |
625 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); | 601 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); |