Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230973
b: refs/heads/master
c: 3351918
h: refs/heads/master
i:
  230971: a9510b6
v: v3
  • Loading branch information
Heiko Carstens authored and Martin Schwidefsky committed Jan 12, 2011
1 parent 35e8b18 commit d2731d7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a05c90f1948baacedd0c3e7e3250225be4cae727
refs/heads/master: 3351918282fd664e918a3175ddfae9b15656122e
3 changes: 3 additions & 0 deletions trunk/arch/s390/include/asm/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,7 @@ struct linux_binprm;
#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
int arch_setup_additional_pages(struct linux_binprm *, int);

extern unsigned long arch_randomize_brk(struct mm_struct *mm);
#define arch_randomize_brk arch_randomize_brk

#endif
18 changes: 18 additions & 0 deletions trunk/arch/s390/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,21 @@ unsigned long arch_align_stack(unsigned long sp)
sp -= get_random_int() & ~PAGE_MASK;
return sp & ~0xf;
}

static inline unsigned long brk_rnd(void)
{
/* 8MB for 32bit, 1GB for 64bit */
if (is_32bit_task())
return (get_random_int() & 0x7ffUL) << PAGE_SHIFT;
else
return (get_random_int() & 0x3ffffUL) << PAGE_SHIFT;
}

unsigned long arch_randomize_brk(struct mm_struct *mm)
{
unsigned long ret = PAGE_ALIGN(mm->brk + brk_rnd());

if (ret < mm->brk)
return mm->brk;
return ret;
}

0 comments on commit d2731d7

Please sign in to comment.