linux/arch/parisc/kernel
Helge Deller d045c77c1a parisc,metag: Fix crashes due to stack randomization on stack-grows-upwards architectures
On architectures where the stack grows upwards (CONFIG_STACK_GROWSUP=y,
currently parisc and metag only) stack randomization sometimes leads to crashes
when the stack ulimit is set to lower values than STACK_RND_MASK (which is 8 MB
by default if not defined in arch-specific headers).

The problem is, that when the stack vm_area_struct is set up in fs/exec.c, the
additional space needed for the stack randomization (as defined by the value of
STACK_RND_MASK) was not taken into account yet and as such, when the stack
randomization code added a random offset to the stack start, the stack
effectively got smaller than what the user defined via rlimit_max(RLIMIT_STACK)
which then sometimes leads to out-of-stack situations and crashes.

This patch fixes it by adding the maximum possible amount of memory (based on
STACK_RND_MASK) which theoretically could be added by the stack randomization
code to the initial stack size. That way, the user-defined stack size is always
guaranteed to be at minimum what is defined via rlimit_max(RLIMIT_STACK).

This bug is currently not visible on the metag architecture, because on metag
STACK_RND_MASK is defined to 0 which effectively disables stack randomization.

The changes to fs/exec.c are inside an "#ifdef CONFIG_STACK_GROWSUP"
section, so it does not affect other platformws beside those where the
stack grows upwards (parisc and metag).

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: linux-parisc@vger.kernel.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: linux-metag@vger.kernel.org
Cc: stable@vger.kernel.org # v3.16+
2015-05-12 22:03:44 +02:00
..
.gitignore
asm-offsets.c arch: Remove exec_domain from remaining archs 2015-04-12 21:03:30 +02:00
audit.c parisc: add kernel audit feature 2013-11-07 22:27:20 +01:00
binfmt_elf32.c
cache.c parisc: change value of SHMLBA from 0x00400000 to PAGE_SIZE 2014-04-13 15:00:53 +02:00
compat_audit.c parisc: add kernel audit feature 2013-11-07 22:27:20 +01:00
drivers.c parisc/PCI: Use dev_is_pci() to identify PCI devices 2013-12-11 16:53:12 -07:00
entry.S parisc: expose number of page table levels on Kconfig level 2015-04-14 16:49:02 -07:00
firmware.c
ftrace.c parisc: ftrace: Remove check of obsolete variable function_trace_stop 2014-07-18 13:57:05 -04:00
hardware.c parisc: add serial ports of C8000/1GHz machine to hardware database 2014-07-13 15:51:58 +02:00
head.S parisc: expose number of page table levels on Kconfig level 2015-04-14 16:49:02 -07:00
hpmc.S
inventory.c
irq.c parisc: fix up obsolete cpu function usage. 2015-03-05 15:25:08 +10:30
Makefile parisc: add kernel audit feature 2013-11-07 22:27:20 +01:00
module.c mm: vmalloc: pass additional vm_flags to __vmalloc_node_range() 2015-02-13 21:21:42 -08:00
pa7300lc.c
pacache.S
parisc_ksyms.c
pci-dma.c parisc: Eliminate sg_virt_addr() and private scatterlist.h 2015-04-21 22:02:43 +02:00
pci.c
pdc_chassis.c
pdc_cons.c
perf_asm.S
perf_images.h
perf.c
process.c parisc: copy_thread(): rename 'arg' argument to 'kthread_arg' 2015-04-24 13:45:55 +02:00
processor.c
ptrace.c Merge git://git.infradead.org/users/eparis/audit 2014-10-19 16:25:56 -07:00
real2.S
setup.c parisc: correctly display number of active CPUs 2013-11-07 22:29:05 +01:00
signal32.c constify copy_siginfo_to_user{,32}() 2013-11-09 00:16:29 -05:00
signal32.h constify copy_siginfo_to_user{,32}() 2013-11-09 00:16:29 -05:00
signal.c parisc: hpux - Remove hpux gateway page 2015-02-16 22:35:06 +01:00
smp.c parisc: Remove unused function 2015-02-17 10:41:19 +01:00
stacktrace.c
sys_parisc32.c parisc: drop unused defines and header includes 2014-07-13 15:56:12 +02:00
sys_parisc.c parisc,metag: Fix crashes due to stack randomization on stack-grows-upwards architectures 2015-05-12 22:03:44 +02:00
syscall_table.S parisc: Add compile-time check when adding new syscalls 2015-03-23 10:57:25 +01:00
syscall.S parisc: Implement new LWS CAS supporting 64 bit operations. 2014-09-13 22:40:48 +02:00
time.c
topology.c
traps.c parisc: ratelimit userspace segfault printing 2014-05-15 21:12:15 +02:00
unaligned.c
unwind.c parisc: use kernel_text_address() in unwind functions 2013-11-30 22:08:54 +01:00
vmlinux.lds.S parisc: fix kernel memory layout in vmlinux.ld.S 2013-11-30 22:09:21 +01:00