mirror of https://github.com/torvalds/linux.git
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+ |
||
|---|---|---|
| .. | ||
| Kbuild | ||
| agp.h | ||
| asm-offsets.h | ||
| asmregs.h | ||
| assembly.h | ||
| atomic.h | ||
| bitops.h | ||
| bug.h | ||
| bugs.h | ||
| cache.h | ||
| cacheflush.h | ||
| checksum.h | ||
| cmpxchg.h | ||
| compat.h | ||
| compat_ucontext.h | ||
| current.h | ||
| delay.h | ||
| dma-mapping.h | ||
| dma.h | ||
| eisa_bus.h | ||
| eisa_eeprom.h | ||
| elf.h | ||
| fb.h | ||
| fixmap.h | ||
| floppy.h | ||
| ftrace.h | ||
| futex.h | ||
| grfioctl.h | ||
| hardirq.h | ||
| hardware.h | ||
| ide.h | ||
| io.h | ||
| irq.h | ||
| irqflags.h | ||
| kbdleds.h | ||
| kmap_types.h | ||
| ldcw.h | ||
| led.h | ||
| linkage.h | ||
| machdep.h | ||
| mc146818rtc.h | ||
| mckinley.h | ||
| mmu.h | ||
| mmu_context.h | ||
| mmzone.h | ||
| module.h | ||
| page.h | ||
| parisc-device.h | ||
| parport.h | ||
| pci.h | ||
| pdc.h | ||
| pdc_chassis.h | ||
| pdcpat.h | ||
| perf.h | ||
| perf_event.h | ||
| pgalloc.h | ||
| pgtable.h | ||
| prefetch.h | ||
| processor.h | ||
| psw.h | ||
| ptrace.h | ||
| ropes.h | ||
| rt_sigframe.h | ||
| rtc.h | ||
| runway.h | ||
| sections.h | ||
| serial.h | ||
| shmparam.h | ||
| signal.h | ||
| smp.h | ||
| socket.h | ||
| special_insns.h | ||
| spinlock.h | ||
| spinlock_types.h | ||
| string.h | ||
| superio.h | ||
| switch_to.h | ||
| syscall.h | ||
| termios.h | ||
| thread_info.h | ||
| timex.h | ||
| tlb.h | ||
| tlbflush.h | ||
| traps.h | ||
| uaccess.h | ||
| ucontext.h | ||
| unaligned.h | ||
| unistd.h | ||
| unwind.h | ||