aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2011-01-12 09:55:31 +0100
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2011-01-12 09:55:25 +0100
commitd2c9dfccbc3a449b9677772e7496e2656049d9f3 (patch)
treef62cf27ddee310af28244bcfbc8eb2e197ed629c /arch/s390/kernel
parent3351918282fd664e918a3175ddfae9b15656122e (diff)
downloadkernel_samsung_espresso10-d2c9dfccbc3a449b9677772e7496e2656049d9f3.zip
kernel_samsung_espresso10-d2c9dfccbc3a449b9677772e7496e2656049d9f3.tar.gz
kernel_samsung_espresso10-d2c9dfccbc3a449b9677772e7496e2656049d9f3.tar.bz2
[S390] Randomize PIEs
Randomize ELF_ET_DYN_BASE, which is used when loading position independent executables. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/process.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 26d48fe..a895e69 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -359,3 +359,14 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
return mm->brk;
return ret;
}
+
+unsigned long randomize_et_dyn(unsigned long base)
+{
+ unsigned long ret = PAGE_ALIGN(base + brk_rnd());
+
+ if (!(current->flags & PF_RANDOMIZE))
+ return base;
+ if (ret < base)
+ return base;
+ return ret;
+}