]> Git Repo - linux.git/commitdiff
x86 get_unmapped_area: Access mmap_legacy_base through mm_struct member
authorRadu Caragea <[email protected]>
Wed, 21 Aug 2013 17:55:59 +0000 (20:55 +0300)
committerLinus Torvalds <[email protected]>
Thu, 22 Aug 2013 17:19:35 +0000 (10:19 -0700)
This is the updated version of df54d6fa5427 ("x86 get_unmapped_area():
use proper mmap base for bottom-up direction") that only randomizes the
mmap base address once.

Signed-off-by: Radu Caragea <[email protected]>
Reported-and-tested-by: Jeff Shorey <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Michel Lespinasse <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Adrian Sendroiu <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Kamal Mostafa <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
arch/x86/kernel/sys_x86_64.c
arch/x86/mm/mmap.c
include/linux/mm_types.h

index dbded5aedb818d511a46967ccb1d26d77233110f..30277e27431acde9a9320e0b1be4470bddb40e3a 100644 (file)
@@ -101,7 +101,7 @@ static void find_start_end(unsigned long flags, unsigned long *begin,
                                *begin = new_begin;
                }
        } else {
-               *begin = TASK_UNMAPPED_BASE;
+               *begin = current->mm->mmap_legacy_base;
                *end = TASK_SIZE;
        }
 }
index 62c29a5bfe26aeb67bf63fb545294b79765e445f..25e7e1372bb26e961b580c753407edf28a320aa3 100644 (file)
@@ -112,11 +112,13 @@ static unsigned long mmap_legacy_base(void)
  */
 void arch_pick_mmap_layout(struct mm_struct *mm)
 {
+       mm->mmap_legacy_base = mmap_legacy_base();
+       mm->mmap_base = mmap_base();
+
        if (mmap_is_legacy()) {
-               mm->mmap_base = mmap_legacy_base();
+               mm->mmap_base = mm->mmap_legacy_base;
                mm->get_unmapped_area = arch_get_unmapped_area;
        } else {
-               mm->mmap_base = mmap_base();
                mm->get_unmapped_area = arch_get_unmapped_area_topdown;
        }
 }
index fb425aa16c0149fdf35b9fe6a1be3a56577d3ff7..faf4b7c1ad12702db919bd03a448741b7e579789 100644 (file)
@@ -332,6 +332,7 @@ struct mm_struct {
                                unsigned long pgoff, unsigned long flags);
 #endif
        unsigned long mmap_base;                /* base of mmap area */
+       unsigned long mmap_legacy_base;         /* base of mmap area in bottom-up allocations */
        unsigned long task_size;                /* size of task vm space */
        unsigned long highest_vm_end;           /* highest vma end address */
        pgd_t * pgd;
This page took 0.078017 seconds and 4 git commands to generate.