Commit d61e16df authored by David S. Miller's avatar David S. Miller

[SPARC64]: Increase top of 32-bit process stack.

Put it one page below the top of the 32-bit address space.
This gives us ~16MB more address space to work with.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a91690dd
...@@ -153,7 +153,9 @@ MODULE_AUTHOR("Eric Youngdale, David S. Miller, Jakub Jelinek"); ...@@ -153,7 +153,9 @@ MODULE_AUTHOR("Eric Youngdale, David S. Miller, Jakub Jelinek");
#undef MODULE_DESCRIPTION #undef MODULE_DESCRIPTION
#undef MODULE_AUTHOR #undef MODULE_AUTHOR
#include <asm/a.out.h>
#undef TASK_SIZE #undef TASK_SIZE
#define TASK_SIZE 0xf0000000 #define TASK_SIZE STACK_TOP32
#include "../../../fs/binfmt_elf.c" #include "../../../fs/binfmt_elf.c"
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <asm/ipc.h> #include <asm/ipc.h>
#include <asm/utrap.h> #include <asm/utrap.h>
#include <asm/perfctr.h> #include <asm/perfctr.h>
#include <asm/a.out.h>
/* #define DEBUG_UNIMP_SYSCALL */ /* #define DEBUG_UNIMP_SYSCALL */
...@@ -130,7 +131,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi ...@@ -130,7 +131,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
} }
if (test_thread_flag(TIF_32BIT)) if (test_thread_flag(TIF_32BIT))
task_size = 0xf0000000UL; task_size = STACK_TOP32;
if (unlikely(len > task_size || len >= VA_EXCLUDE_START)) if (unlikely(len > task_size || len >= VA_EXCLUDE_START))
return -ENOMEM; return -ENOMEM;
...@@ -203,7 +204,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, ...@@ -203,7 +204,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
{ {
struct vm_area_struct *vma; struct vm_area_struct *vma;
struct mm_struct *mm = current->mm; struct mm_struct *mm = current->mm;
unsigned long task_size = 0xf0000000UL; unsigned long task_size = STACK_TOP32;
unsigned long addr = addr0; unsigned long addr = addr0;
int do_color_align; int do_color_align;
...@@ -370,7 +371,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm) ...@@ -370,7 +371,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
mm->unmap_area = arch_unmap_area; mm->unmap_area = arch_unmap_area;
} else { } else {
/* We know it's 32-bit */ /* We know it's 32-bit */
unsigned long task_size = 0xf0000000UL; unsigned long task_size = STACK_TOP32;
unsigned long gap; unsigned long gap;
gap = current->signal->rlim[RLIMIT_STACK].rlim_cur; gap = current->signal->rlim[RLIMIT_STACK].rlim_cur;
...@@ -388,7 +389,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm) ...@@ -388,7 +389,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
asmlinkage unsigned long sparc_brk(unsigned long brk) asmlinkage unsigned long sparc_brk(unsigned long brk)
{ {
/* People could try to be nasty and use ta 0x6d in 32bit programs */ /* People could try to be nasty and use ta 0x6d in 32bit programs */
if (test_thread_flag(TIF_32BIT) && brk >= 0xf0000000UL) if (test_thread_flag(TIF_32BIT) && brk >= STACK_TOP32)
return current->mm->brk; return current->mm->brk;
if (unlikely(straddles_64bit_va_hole(current->mm->brk, brk))) if (unlikely(straddles_64bit_va_hole(current->mm->brk, brk)))
...@@ -554,10 +555,10 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, ...@@ -554,10 +555,10 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
retval = -EINVAL; retval = -EINVAL;
if (test_thread_flag(TIF_32BIT)) { if (test_thread_flag(TIF_32BIT)) {
if (len >= 0xf0000000UL) if (len >= STACK_TOP32)
goto out_putf; goto out_putf;
if ((flags & MAP_FIXED) && addr > 0xf0000000UL - len) if ((flags & MAP_FIXED) && addr > STACK_TOP32 - len)
goto out_putf; goto out_putf;
} else { } else {
if (len >= VA_EXCLUDE_START) if (len >= VA_EXCLUDE_START)
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#include <asm/fpumacro.h> #include <asm/fpumacro.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
#include <asm/a.out.h>
asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group) asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group)
{ {
...@@ -1039,15 +1040,15 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr, ...@@ -1039,15 +1040,15 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr,
unsigned long ret = -EINVAL; unsigned long ret = -EINVAL;
unsigned long new_addr = __new_addr; unsigned long new_addr = __new_addr;
if (old_len > 0xf0000000UL || new_len > 0xf0000000UL) if (old_len > STACK_TOP32 || new_len > STACK_TOP32)
goto out; goto out;
if (addr > 0xf0000000UL - old_len) if (addr > STACK_TOP32 - old_len)
goto out; goto out;
down_write(&current->mm->mmap_sem); down_write(&current->mm->mmap_sem);
if (flags & MREMAP_FIXED) { if (flags & MREMAP_FIXED) {
if (new_addr > 0xf0000000UL - new_len) if (new_addr > STACK_TOP32 - new_len)
goto out_sem; goto out_sem;
} else if (addr > 0xf0000000UL - new_len) { } else if (addr > STACK_TOP32 - new_len) {
unsigned long map_flags = 0; unsigned long map_flags = 0;
struct file *file = NULL; struct file *file = NULL;
......
...@@ -90,7 +90,7 @@ static u32 do_solaris_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u64 o ...@@ -90,7 +90,7 @@ static u32 do_solaris_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u64 o
len = PAGE_ALIGN(len); len = PAGE_ALIGN(len);
if(!(flags & MAP_FIXED)) if(!(flags & MAP_FIXED))
addr = 0; addr = 0;
else if (len > 0xf0000000UL || addr > 0xf0000000UL - len) else if (len > STACK_TOP32 || addr > STACK_TOP32 - len)
goto out_putf; goto out_putf;
ret_type = flags & _MAP_NEW; ret_type = flags & _MAP_NEW;
flags &= ~_MAP_NEW; flags &= ~_MAP_NEW;
...@@ -102,7 +102,7 @@ static u32 do_solaris_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u64 o ...@@ -102,7 +102,7 @@ static u32 do_solaris_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u64 o
(unsigned long) prot, (unsigned long) flags, off); (unsigned long) prot, (unsigned long) flags, off);
up_write(&current->mm->mmap_sem); up_write(&current->mm->mmap_sem);
if(!ret_type) if(!ret_type)
retval = ((retval < 0xf0000000) ? 0 : retval); retval = ((retval < STACK_TOP32) ? 0 : retval);
out_putf: out_putf:
if (file) if (file)
......
...@@ -95,9 +95,11 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */ ...@@ -95,9 +95,11 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */
#ifdef __KERNEL__ #ifdef __KERNEL__
#define STACK_TOP32 ((1UL << 32UL) - PAGE_SIZE)
#define STACK_TOP64 (0x0000080000000000UL - (1UL << 32UL))
#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \ #define STACK_TOP (test_thread_flag(TIF_32BIT) ? \
0xf0000000 : \ STACK_TOP32 : STACK_TOP64)
(0x0000080000000000UL - (1UL << 32UL)))
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment