Skip to contentSkip to conversation

parisc: add flexible mmap layout support

PATCH New Helge Deller 1 participant 1 message Dec 3, 2013

Subsystems (2)
lore
Share & tools
lore

Helge Deller

author maintainer
#0 lore raw

PATCH 1/1 parisc: add flexible mmap layout support

- initial version
- add mmap address & stack randomization
- probably fixes a few other bugs in the mmap code
- can be enabled/turned off by "echo 0/1 > /proc/sys/vm/legacy_va_layout
- new flexible mmap layout is by default turned on

arch/parisc/include/asm/elf.h +7 -0
index ad2b503..80db5b2 100644
@@ -348,4 +348,11 @@ struct pt_regs;	/* forward declaration... */
 
 #define ELF_HWCAP	0
 
+/* Stack randomization: 1GB for 64bit, 8MB for 32bit */
+#ifdef CONFIG_64BIT
+# define STACK_RND_MASK (test_thread_flag(TIF_32BIT) ? 0x7ff : 0x3fffff)
+#else
+# define STACK_RND_MASK (0x7ff)
+#endif
+
 #endif
arch/parisc/include/asm/pgtable.h +1 -0
index 34899b5..22b89d1 100644
@@ -511,6 +511,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
 /* We provide our own get_unmapped_area to provide cache coherency */
 
 #define HAVE_ARCH_UNMAPPED_AREA
+#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
 
 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
arch/parisc/include/asm/processor.h +2 -0
index 9cbee39..75985b8 100644
@@ -30,6 +30,8 @@
 #endif
 #define current_text_addr() ({ void *pc; current_ia(pc); pc; })
 
+#define HAVE_ARCH_PICK_MMAP_LAYOUT
+
 #define TASK_SIZE_OF(tsk)       ((tsk)->thread.task_size)
 #define TASK_SIZE	        TASK_SIZE_OF(current)
 #define TASK_UNMAPPED_BASE      (current->thread.map_base)
arch/parisc/kernel/sys_parisc.c +190 -28

264 lines not on this page · raw message