x86/mm: Fix ELF_ET_DYN_BASE for 5-level paging
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Tue, 7 Nov 2017 10:38:04 +0000 (13:38 +0300)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 9 Nov 2017 17:20:20 +0000 (18:20 +0100)
commitbe739f4b5ddece74ef25e2304b17a7fd24575e9b
tree2e0f2e78107f54781f4e278bdbbd5df0a14760bc
parentd0cd64b02aa854d68ce517cb7da1fe4e4fff2653
x86/mm: Fix ELF_ET_DYN_BASE for 5-level paging

On machines with 5-level paging we don't want to allocate mapping above
47-bit unless user explicitly asked for it. See b569bab78d8d ("x86/mm:
Prepare to expose larger address space to userspace") for details.

c715b72c1ba4 ("mm: revert x86_64 and arm64 ELF_ET_DYN_BASE base
changes") broke the behaviour. After the commit elf binary and heap got
mapped above 47-bits.

Use DEFAULT_MAP_WINDOW instead of TASK_SIZE to determine ELF_ET_DYN_BASE so
it's forced to be below 47-bits unconditionally.

Fixes: c715b72c1ba4 ("mm: revert x86_64 and arm64 ELF_ET_DYN_BASE base changes")
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: https://lkml.kernel.org/r/20171107103804.47341-1-kirill.shutemov@linux.intel.com
arch/x86/include/asm/elf.h