Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230970
b: refs/heads/master
c: df1ca53
h: refs/heads/master
v: v3
  • Loading branch information
Heiko Carstens authored and Martin Schwidefsky committed Jan 12, 2011
1 parent 0793f9b commit 4d565c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1060f62ea47e609b0c1672e8d1ac216e57f11a8e
refs/heads/master: df1ca53cba34b1d40a4ed47907d71397e4ee72c2
13 changes: 11 additions & 2 deletions trunk/arch/s390/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/personality.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/random.h>
#include <asm/pgalloc.h>
#include <asm/compat.h>

Expand Down Expand Up @@ -56,6 +57,14 @@ static inline int mmap_is_legacy(void)
return sysctl_legacy_va_layout;
}

static unsigned long mmap_rnd(void)
{
if (!(current->flags & PF_RANDOMIZE))
return 0;
/* 8MB randomization for mmap_base */
return (get_random_int() & 0x7ffUL) << PAGE_SHIFT;
}

static inline unsigned long mmap_base(void)
{
unsigned long gap = rlimit(RLIMIT_STACK);
Expand All @@ -64,8 +73,8 @@ static inline unsigned long mmap_base(void)
gap = MIN_GAP;
else if (gap > MAX_GAP)
gap = MAX_GAP;

return STACK_TOP - stack_maxrandom_size() - (gap & PAGE_MASK);
gap &= PAGE_MASK;
return STACK_TOP - stack_maxrandom_size() - mmap_rnd() - gap;
}

#ifndef CONFIG_64BIT
Expand Down

0 comments on commit 4d565c5

Please sign in to comment.