The patch titled Subject: binfmt_elf: document load_bias a little bit has been added to the -mm tree. Its filename is binfmt_elf-document-load_bias-a-little-bit.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/binfmt_elf-document-load_bias-a-little-bit.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/binfmt_elf-document-load_bias-a-little-bit.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Rik van Riel <riel@xxxxxxxxxx> Subject: binfmt_elf: document load_bias a little bit Patch series "move mmap_area and PIE binaries away from the stack". There are a few bugs causing the kernel to sometimes map PIE binaries and the mmap_area where the stack is supposed to go. This series fixes them for x86, ARM64, and PPC. S390 seems to be ok. This patch (of 6): After I and another unnamed developer got confused by the subtraction of vaddr in this branch of the code, followed by adding vaddr back in a little bit later, for the third time, maybe it is time to document this quirky bit of code. Link: http://lkml.kernel.org/r/20170602152010.2064-2-riel@xxxxxxxxxx Signed-off-by: Rik van Riel <riel@xxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: Larry Woodman <lwoodman@xxxxxxxxxx> Cc: Daniel Micay <danielmicay@xxxxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Florian Weimer <fweimer@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/binfmt_elf.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff -puN fs/binfmt_elf.c~binfmt_elf-document-load_bias-a-little-bit fs/binfmt_elf.c --- a/fs/binfmt_elf.c~binfmt_elf-document-load_bias-a-little-bit +++ a/fs/binfmt_elf.c @@ -930,10 +930,16 @@ static int load_elf_binary(struct linux_ if (loc->elf_ex.e_type == ET_EXEC || load_addr_set) { elf_flags |= MAP_FIXED; } else if (loc->elf_ex.e_type == ET_DYN) { - /* Try and get dynamic programs out of the way of the + /* + * Try and get dynamic programs out of the way of the * default mmap base, as well as whatever program they * might try to exec. This is because the brk will - * follow the loader, and is not movable. */ + * follow the loader, and is not movable. + * + * The load_bias is the difference between the address + * in the elf header and the address where the binary + * is mmapped. + */ load_bias = ELF_ET_DYN_BASE - vaddr; if (current->flags & PF_RANDOMIZE) load_bias += arch_mmap_rnd(); _ Patches currently in -mm which might be from riel@xxxxxxxxxx are binfmt_elf-document-load_bias-a-little-bit.patch x86-elf-move-32-bit-elf_et_dyn_base-to-256mb.patch x86-mmap-properly-account-for-stack-randomization-in-mmap_base.patch arm64-mmap-properly-account-for-stack-randomization-in-mmap_base.patch arm64-move-compat_elf_et_dyn_base-lower-in-the-address-space.patch powerpcmmap-properly-account-for-stack-randomization-in-mmap_base.patch randomstackprotect-introduce-get_random_canary-function.patch forkrandom-use-get_random_canary-to-set-tsk-stack_canary.patch x86-ascii-armor-the-x86_64-boot-init-stack-canary.patch arm64-ascii-armor-the-arm64-boot-init-stack-canary.patch sh64-ascii-armor-the-sh64-boot-init-stack-canary.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html