Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86 get_unmapped_area: Access mmap_legacy_base through mm_struct member

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 <sinaelgl@gmail.com>
Reported-and-tested-by: Jeff Shorey <shoreyjeff@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michel Lespinasse <walken@google.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Adrian Sendroiu <molecula2788@gmail.com>
Cc: Greg KH <greg@kroah.com>
Cc: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Radu Caragea and committed by
Linus Torvalds
41aacc1e 5ea80f76

+6 -3
+1 -1
arch/x86/kernel/sys_x86_64.c
··· 101 101 *begin = new_begin; 102 102 } 103 103 } else { 104 - *begin = TASK_UNMAPPED_BASE; 104 + *begin = current->mm->mmap_legacy_base; 105 105 *end = TASK_SIZE; 106 106 } 107 107 }
+4 -2
arch/x86/mm/mmap.c
··· 112 112 */ 113 113 void arch_pick_mmap_layout(struct mm_struct *mm) 114 114 { 115 + mm->mmap_legacy_base = mmap_legacy_base(); 116 + mm->mmap_base = mmap_base(); 117 + 115 118 if (mmap_is_legacy()) { 116 - mm->mmap_base = mmap_legacy_base(); 119 + mm->mmap_base = mm->mmap_legacy_base; 117 120 mm->get_unmapped_area = arch_get_unmapped_area; 118 121 } else { 119 - mm->mmap_base = mmap_base(); 120 122 mm->get_unmapped_area = arch_get_unmapped_area_topdown; 121 123 } 122 124 }
+1
include/linux/mm_types.h
··· 332 332 unsigned long pgoff, unsigned long flags); 333 333 #endif 334 334 unsigned long mmap_base; /* base of mmap area */ 335 + unsigned long mmap_legacy_base; /* base of mmap area in bottom-up allocations */ 335 336 unsigned long task_size; /* size of task vm space */ 336 337 unsigned long highest_vm_end; /* highest vma end address */ 337 338 pgd_t * pgd;