Files
android_kernel_xiaomi_sm8450/arch/parisc/include/asm
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
..
2014-04-18 14:20:41 +02:00
2012-06-05 14:10:17 +09:00
2014-02-02 20:57:16 +01:00
2009-01-05 19:11:05 +00:00
2013-11-07 22:28:26 +01:00
2012-03-28 18:30:02 +01:00
2011-03-31 11:26:23 -03:00
2013-02-20 22:50:26 +01:00
2013-11-07 22:28:54 +01:00
2010-10-07 14:08:55 +01:00
2011-07-26 16:49:47 -07:00
2012-03-28 18:30:02 +01:00
2013-11-07 22:27:20 +01:00
2012-03-28 18:30:02 +01:00
2015-02-17 10:39:14 +01:00