Re: [PATCH v2] binfmt_elf: Use ELF_ET_DYN_BASE only for PIE

From: Rik van Riel
Date: Wed Jun 21 2017 - 14:24:49 EST


On Wed, 2017-06-21 at 10:32 -0700, Kees Cook wrote:

> To allow for a lower ELF_ET_DYN_BASE, loaders (ET_DYN without INTERP)
> are loaded into the mmap region, leaving space available for either
> an
> ET_EXEC binary with a fixed location or PIE being loaded into mmap by
> the
> loader. Only PIE programs are loaded offset from ELF_ET_DYN_BASE,
> which
> means architectures can now safely lower their values without risk of
> loaders colliding with their subsequently loaded programs.
>
> For 64-bit, ELF_ET_DYN_BASE is best set to 4GB to allow runtimes to
> use
> the entire 32-bit address space for 32-bit pointers.
>
> Thanks to PaX Team, Daniel Micay, and Rik van Riel for inspiration
> and
> suggestions on how to implement this solution.
>
> Fixes: d1fd836dcf00 ("mm: split ET_DYN ASLR from mmap ASLR")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>

Acked-by: Rik van Riel <riel@xxxxxxxxxx>