|
@@ -35,7 +35,7 @@
|
|
* Leave enough space between the mmap area and the stack to honour ulimit in
|
|
* Leave enough space between the mmap area and the stack to honour ulimit in
|
|
* the face of randomisation.
|
|
* the face of randomisation.
|
|
*/
|
|
*/
|
|
-#define MIN_GAP (SZ_128M + ((STACK_RND_MASK << PAGE_SHIFT) + 1))
|
|
|
|
|
|
+#define MIN_GAP (SZ_128M)
|
|
#define MAX_GAP (STACK_TOP/6*5)
|
|
#define MAX_GAP (STACK_TOP/6*5)
|
|
|
|
|
|
static int mmap_is_legacy(void)
|
|
static int mmap_is_legacy(void)
|
|
@@ -65,6 +65,11 @@ unsigned long arch_mmap_rnd(void)
|
|
static unsigned long mmap_base(unsigned long rnd)
|
|
static unsigned long mmap_base(unsigned long rnd)
|
|
{
|
|
{
|
|
unsigned long gap = rlimit(RLIMIT_STACK);
|
|
unsigned long gap = rlimit(RLIMIT_STACK);
|
|
|
|
+ unsigned long pad = (STACK_RND_MASK << PAGE_SHIFT) + stack_guard_gap;
|
|
|
|
+
|
|
|
|
+ /* Values close to RLIM_INFINITY can overflow. */
|
|
|
|
+ if (gap + pad > gap)
|
|
|
|
+ gap += pad;
|
|
|
|
|
|
if (gap < MIN_GAP)
|
|
if (gap < MIN_GAP)
|
|
gap = MIN_GAP;
|
|
gap = MIN_GAP;
|