diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2017-07-17 00:59:52 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-07-21 10:05:18 +0200 |
commit | b569bab78d8df157a6f91070af827753e4d1787c (patch) | |
tree | 7aa262b0b10979076a3f66093df2c9628d9ff5bf /arch/x86/include/asm/elf.h | |
parent | x86/mpx: Do not allow MPX if we have mappings above 47-bit (diff) | |
download | linux-b569bab78d8df157a6f91070af827753e4d1787c.tar.xz linux-b569bab78d8df157a6f91070af827753e4d1787c.zip |
x86/mm: Prepare to expose larger address space to userspace
On x86, 5-level paging enables 56-bit userspace virtual address space.
Not all user space is ready to handle wide addresses. It's known that
at least some JIT compilers use higher bits in pointers to encode their
information. It collides with valid pointers with 5-level paging and
leads to crashes.
To mitigate this, we are not going to allocate virtual address space
above 47-bit by default.
But userspace can ask for allocation from full address space by
specifying hint address (with or without MAP_FIXED) above 47-bits.
If hint address set above 47-bit, but MAP_FIXED is not specified, we try
to look for unmapped area by specified address. If it's already
occupied, we look for unmapped area in *full* address space, rather than
from 47-bit window.
A high hint address would only affect the allocation in question, but not
any future mmap()s.
Specifying high hint address on older kernel or on machine without 5-level
paging support is safe. The hint will be ignored and kernel will fall back
to allocation from 47-bit address space.
This approach helps to easily make application's memory allocator aware
about large address space without manually tracking allocated virtual
address space.
The patch puts all machinery in place, but not yet allows userspace to have
mappings above 47-bit -- TASK_SIZE_MAX has to be raised to get the effect.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-arch@vger.kernel.org
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20170716225954.74185-7-kirill.shutemov@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/include/asm/elf.h')
-rw-r--r-- | arch/x86/include/asm/elf.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h index c7090ef1388e..f87f4d73c700 100644 --- a/arch/x86/include/asm/elf.h +++ b/arch/x86/include/asm/elf.h @@ -305,7 +305,7 @@ static inline int mmap_is_ia32(void) } extern unsigned long task_size_32bit(void); -extern unsigned long task_size_64bit(void); +extern unsigned long task_size_64bit(int full_addr_space); extern unsigned long get_mmap_base(int is_legacy); #ifdef CONFIG_X86_32 |