x86/mm: Fix ELF_ET_DYN_BASE for 5-level paging
Subsystems (3)
PATCH 1/1 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.
Let's fix this.
--- arch/x86/include/asm/elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/elf.h +1 -1
@@ -253,7 +253,7 @@ extern int force_personality32;* space open for things that want to use the area for 32-bit pointers. */ #define ELF_ET_DYN_BASE (mmap_is_ia32() ? 0x000400000UL : \ - (TASK_SIZE / 3 * 2)) + (DEFAULT_MAP_WINDOW / 3 * 2))/* This yields a mask that user programs can use to figure out what instruction set this CPU supports. This could be done in user space,
Signature · 7 lines
2.14.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · Kirill A. Shutemov
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: revertx86_64and arm64ELF_ET_DYN_BASEbase changes") broke the behaviour. After the commit elf binary and heap got mapped above 47-bits.Let's fix this.
Quoted 7 lines
Signed-off-by Kirill A. Shutemov <[email protected]>Fixes c715b72c1ba4 ("mm: revert x86_64 and arm64 ELF_ET_DYN_BASE base changes")Cc Kees Cook <[email protected]>Cc Ingo Molnar <[email protected]>Cc "H. Peter Anvin" <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Nicholas Piggin <[email protected]>
Folks, can we please get this applied?
Without the change on 5-level paging machine we will have elf binary and heap mapped above 47-bit by default. This may lead to userspace brakage.
Quoted 25 lines
--- arch/x86/include/asm/elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/include/asm/elf.h +1
-1@@ -253,7 +253,7 @@ extern int force_personality32;* space open for things that want to use the area for 32-bit pointers. */ #define ELF_ET_DYN_BASE (mmap_is_ia32() ? 0x000400000UL : \ - (TASK_SIZE / 3 * 2)) + (DEFAULT_MAP_WINDOW / 3 * 2))/* This yields a mask that user programs can use to figure out what instruction set this CPU supports. This could be done in user space, Signature · 7 lines
2.14.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Signature · 7 lines
Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · Kirill A. Shutemov
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: revertx86_64and arm64ELF_ET_DYN_BASEbase changes") broke the behaviour. After the commit elf binary and heap got mapped above 47-bits.Let's fix this.
Quoted 7 lines
Signed-off-by Kirill A. Shutemov <[email protected]>Fixes c715b72c1ba4 ("mm: revert x86_64 and arm64 ELF_ET_DYN_BASE base changes")Cc Kees Cook <[email protected]>Cc Ingo Molnar <[email protected]>Cc "H. Peter Anvin" <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Nicholas Piggin <[email protected]>
FWIW
Quoted 19 lines
--- arch/x86/include/asm/elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/include/asm/elf.h +1
-1@@ -253,7 +253,7 @@ extern int force_personality32;* space open for things that want to use the area for 32-bit pointers. */ #define ELF_ET_DYN_BASE (mmap_is_ia32() ? 0x000400000UL : \ - (TASK_SIZE / 3 * 2)) + (DEFAULT_MAP_WINDOW / 3 * 2))/* This yields a mask that user programs can use to figure out what instruction set this CPU supports. This could be done in user space, Signature · 1 line
2.14.2
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 9 lines · Kirill A. Shutemov
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: revertx86_64and arm64ELF_ET_DYN_BASEbase changes") broke the behaviour. After the commit elf binary and heap got mapped above 47-bits.Let's fix this.
That's a really useless sentence.....
Quoted 28 lines
Signed-off-by Kirill A. Shutemov <[email protected]>Fixes c715b72c1ba4 ("mm: revert x86_64 and arm64 ELF_ET_DYN_BASE base changes")Cc Kees Cook <[email protected]>Cc Ingo Molnar <[email protected]>Cc "H. Peter Anvin" <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Nicholas Piggin <[email protected]>--- arch/x86/include/asm/elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/include/asm/elf.h +1
-1@@ -253,7 +253,7 @@ extern int force_personality32;* space open for things that want to use the area for 32-bit pointers. */ #define ELF_ET_DYN_BASE (mmap_is_ia32() ? 0x000400000UL : \ - (TASK_SIZE / 3 * 2)) + (DEFAULT_MAP_WINDOW / 3 * 2))/* This yields a mask that user programs can use to figure out what instruction set this CPU supports. This could be done in user space, Signature · 1 line
2.14.2
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
tip-bot for Kirill A. Shutemov
merge botx86/mm: Fix ELF_ET_DYN_BASE for 5-level paging
Commit-ID: be739f4b5ddece74ef25e2304b17a7fd24575e9b Gitweb: https://git.kernel.org/tip/be739f4b5ddece74ef25e2304b17a7fd24575e9b Author: Kirill A. Shutemov <[email protected]> AuthorDate: Tue, 7 Nov 2017 13:38:04 +0300 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 9 Nov 2017 18:20:20 +0100
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.
--- arch/x86/include/asm/elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/elf.h +1 -1
@@ -253,7 +253,7 @@ extern int force_personality32;* space open for things that want to use the area for 32-bit pointers. */ #define ELF_ET_DYN_BASE (mmap_is_ia32() ? 0x000400000UL : \ - (TASK_SIZE / 3 * 2)) + (DEFAULT_MAP_WINDOW / 3 * 2))/* This yields a mask that user programs can use to figure out what instruction set this CPU supports. This could be done in user space,