Patch "mm: revert x86_64 and arm64 ELF_ET_DYN_BASE base changes" has been added to the 4.12-stable tree
Subsystems (4)
This is a note to let you know that I've just added the patch titled
mm: revert x86_64 and arm64 ELF_ET_DYN_BASE base changes
to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
mm-revert-x86_64-and-arm64-elf_et_dyn_base-base-changes.patch
and it can be found in the queue-4.12 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
c715b72c1ba406f133217b509044c38d8e714a37Mon Sep 17 00:00:00 2001
From: Kees Cook <[email protected]>
Date: Fri, 18 Aug 2017 15:16:31 -0700
Subject: mm: revert x86_64 and arm64 ELF_ET_DYN_BASE base changes
From: Kees Cook <[email protected]>
commit c715b72c1ba406f133217b509044c38d8e714a37 upstream.
Moving the x86_64 and arm64 PIE base from 0x555555554000 to 0x000100000000 broke AddressSanitizer. This is a partial revert of:
eab09532d400 ("binfmt_elf: use ELF_ET_DYN_BASE only for PIE") 02445990a96e ("arm64: move ELF_ET_DYN_BASE to 4GB / 4MB")
The AddressSanitizer tool has hard-coded expectations about where executable mappings are loaded.
The motivation for changing the PIE base in the above commits was to avoid the Stack-Clash CVEs that allowed executable mappings to get too close to heap and stack. This was mainly a problem on 32-bit, but the 64-bit bases were moved too, in an effort to proactively protect those systems (proofs of concept do exist that show 64-bit collisions, but other recent changes to fix stack accounting and setuid behaviors will minimize the impact).
The new 32-bit PIE base is fine for ASan (since it matches the ET_EXEC base), so only the 64-bit PIE base needs to be reverted to let x86 and arm64 ASan binaries run again. Future changes to the 64-bit PIE base on these architectures can be made optional once a more dynamic method for dealing with AddressSanitizer is found. (e.g. always loading PIE into the mmap region for marked binaries.)
--- arch/arm64/include/asm/elf.h | 4 ++-- arch/x86/include/asm/elf.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/include/asm/elf.h +2 -2
@@ -114,10 +114,10 @@/* * This is the base location for PIE (ET_DYN with INTERP) loads. On -* 64-bit, this is raised to 4GB to leave the entire 32-bit address +* 64-bit, this is above 4GB to leave the entire 32-bit address * space open for things that want to use the area for 32-bit pointers. */ -#define ELF_ET_DYN_BASE 0x100000000UL +#define ELF_ET_DYN_BASE (2 * TASK_SIZE_64 / 3)#ifndef __ASSEMBLY__
arch/x86/include/asm/elf.h +2 -2
@@ -247,11 +247,11 @@ extern int force_personality32;/* * This is the base location for PIE (ET_DYN with INTERP) loads. On -* 64-bit, this is raised to 4GB to leave the entire 32-bit address +* 64-bit, this is above 4GB to leave the entire 32-bit address * space open for things that want to use the area for 32-bit pointers. */ #define ELF_ET_DYN_BASE (mmap_is_ia32() ? 0x000400000UL : \ - 0x100000000UL) + (TASK_SIZE / 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,
Patches currently in stable-queue which might be from [email protected] are
queue-4.12/mm-revert-x86_64-and-arm64-elf_et_dyn_base-base-changes.patch