aboutsummaryrefslogtreecommitdiffstats
path: root/main/linux-rpi/aslr-pie.patch
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2014-05-29 06:21:29 +0000
committerTimo Teräs <timo.teras@iki.fi>2014-05-29 06:21:29 +0000
commit190398367426d64909c08179d663142d6fee04d3 (patch)
tree1f84ed72c301956800566778cf7419272e884913 /main/linux-rpi/aslr-pie.patch
parent4b44aa3cebd0b390d4347e4dcfadfa6cc8ac4a70 (diff)
downloadaports-190398367426d64909c08179d663142d6fee04d3.tar.bz2
aports-190398367426d64909c08179d663142d6fee04d3.tar.xz
main/linux-rpi: new kernel flavor
Vanilla kernel with Raspberry Pi patches (no grsec) default config for rpi
Diffstat (limited to 'main/linux-rpi/aslr-pie.patch')
-rw-r--r--main/linux-rpi/aslr-pie.patch30
1 files changed, 30 insertions, 0 deletions
diff --git a/main/linux-rpi/aslr-pie.patch b/main/linux-rpi/aslr-pie.patch
new file mode 100644
index 0000000000..a31dba42a8
--- /dev/null
+++ b/main/linux-rpi/aslr-pie.patch
@@ -0,0 +1,30 @@
+--- linux-3.11/fs/binfmt_elf.c.orig
++++ linux-3.11/fs/binfmt_elf.c
+@@ -802,21 +802,19 @@
+ * default mmap base, as well as whatever program they
+ * might try to exec. This is because the brk will
+ * follow the loader, and is not movable. */
++ if (elf_interpreter)
++ load_bias = 0x00400000UL;
++ else
++ load_bias = ELF_ET_DYN_BASE;
+ #ifdef CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE
+ /* Memory randomization might have been switched off
+ * in runtime via sysctl or explicit setting of
+ * personality flags.
+- * If that is the case, retain the original non-zero
+- * load_bias value in order to establish proper
+- * non-randomized mappings.
+ */
+ if (current->flags & PF_RANDOMIZE)
+- load_bias = 0;
+- else
+- load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr);
+-#else
+- load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr);
++ load_bias += (get_random_int() & STACK_RND_MASK) << PAGE_SHIFT;
+ #endif
++ load_bias = ELF_PAGESTART(load_bias - vaddr);
+ }
+
+ error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt,