Subject: + s390-mmap-randomize-mmap-base-for-bottom-up-direction.patch added to -mm tree To: heiko.carstens@xxxxxxxxxx,catalin.marinas@xxxxxxx,cmetcalf@xxxxxxxxxx,schwidefsky@xxxxxxxxxx,sinaelgl@xxxxxxxxx,walken@xxxxxxxxxx,will.deacon@xxxxxxx From: akpm@xxxxxxxxxxxxxxxxxxxx Date: Thu, 10 Oct 2013 15:48:12 -0700 The patch titled Subject: s390/mmap: randomize mmap base for bottom up direction has been added to the -mm tree. Its filename is s390-mmap-randomize-mmap-base-for-bottom-up-direction.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/s390-mmap-randomize-mmap-base-for-bottom-up-direction.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/s390-mmap-randomize-mmap-base-for-bottom-up-direction.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Heiko Carstens <heiko.carstens@xxxxxxxxxx> Subject: s390/mmap: randomize mmap base for bottom up direction Implement mmap base randomization for the bottom up direction, so ASLR works for both mmap layouts on s390. See also df54d6fa54 ("x86 get_unmapped_area(): use proper mmap base for bottom-up direction"). Signed-off-by: Heiko Carstens <heiko.carstens@xxxxxxxxxx> Cc: Radu Caragea <sinaelgl@xxxxxxxxx> Cc: Michel Lespinasse <walken@xxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Cc: Chris Metcalf <cmetcalf@xxxxxxxxxx> Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/s390/mm/mmap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff -puN arch/s390/mm/mmap.c~s390-mmap-randomize-mmap-base-for-bottom-up-direction arch/s390/mm/mmap.c --- a/arch/s390/mm/mmap.c~s390-mmap-randomize-mmap-base-for-bottom-up-direction +++ a/arch/s390/mm/mmap.c @@ -64,6 +64,11 @@ static unsigned long mmap_rnd(void) return (get_random_int() & 0x7ffUL) << PAGE_SHIFT; } +static unsigned long mmap_base_legacy(void) +{ + return TASK_UNMAPPED_BASE + mmap_rnd(); +} + static inline unsigned long mmap_base(void) { unsigned long gap = rlimit(RLIMIT_STACK); @@ -89,7 +94,7 @@ void arch_pick_mmap_layout(struct mm_str * bit is set, or if the expected stack growth is unlimited: */ if (mmap_is_legacy()) { - mm->mmap_base = TASK_UNMAPPED_BASE; + mm->mmap_base = mmap_base_legacy(); mm->get_unmapped_area = arch_get_unmapped_area; } else { mm->mmap_base = mmap_base(); @@ -172,7 +177,7 @@ void arch_pick_mmap_layout(struct mm_str * bit is set, or if the expected stack growth is unlimited: */ if (mmap_is_legacy()) { - mm->mmap_base = TASK_UNMAPPED_BASE; + mm->mmap_base = mmap_base_legacy(); mm->get_unmapped_area = s390_get_unmapped_area; } else { mm->mmap_base = mmap_base(); _ Patches currently in -mm which might be from heiko.carstens@xxxxxxxxxx are origin.patch x86-add-missed-pgtable_pmd_page_ctor-dtor-calls-for-preallocated-pmds.patch s390-handle-pgtable_page_ctor-fail.patch mm-dynamically-allocate-page-ptl-if-it-cannot-be-embedded-to-struct-page.patch mmap-arch_get_unmapped_area-use-proper-mmap-base-for-bottom-up-direction.patch s390-mmap-randomize-mmap-base-for-bottom-up-direction.patch linux-next.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html