diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2017-09-28 12:16:33 +0200 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2017-10-03 00:16:29 +0200 |
commit | 1bb078330b4f0836b5b12365cd8bf68d5f3bbff8 (patch) | |
tree | 0a15f41ace12c4b308ef6cc57e5aa3be0019e05d /fs/binfmt_elf_fdpic.c | |
parent | Merge branch 'xip_zdata' of http://git.linaro.org/people/nicolas.pitre/linux ... (diff) | |
parent | binfmt_elf_fdpic: fix crash on MMU system with dynamic binaries (diff) | |
download | linux-1bb078330b4f0836b5b12365cd8bf68d5f3bbff8.tar.xz linux-1bb078330b4f0836b5b12365cd8bf68d5f3bbff8.zip |
Merge branch 'fdpic' of http://git.linaro.org/people/nicolas.pitre/linux into devel-stable
This series provides the needed changes to suport the ELF_FDPIC binary
format on ARM. Both MMU and non-MMU systems are supported. This format
has many advantages over the BFLT format used on MMU-less systems, such
as being real ELF that can be parsed by standard tools, can support
shared dynamic libs, etc.
Diffstat (limited to 'fs/binfmt_elf_fdpic.c')
-rw-r--r-- | fs/binfmt_elf_fdpic.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index e70c039ac190..5429b035e249 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c @@ -378,6 +378,11 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm) executable_stack); if (retval < 0) goto error; +#ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES + retval = arch_setup_additional_pages(bprm, !!interpreter_name); + if (retval < 0) + goto error; +#endif #endif /* load the executable and interpreter into memory */ @@ -831,6 +836,9 @@ static int elf_fdpic_map_file(struct elf_fdpic_params *params, if (phdr->p_vaddr >= seg->p_vaddr && phdr->p_vaddr + phdr->p_memsz <= seg->p_vaddr + seg->p_memsz) { + Elf32_Dyn __user *dyn; + Elf32_Sword d_tag; + params->dynamic_addr = (phdr->p_vaddr - seg->p_vaddr) + seg->addr; @@ -843,8 +851,9 @@ static int elf_fdpic_map_file(struct elf_fdpic_params *params, goto dynamic_error; tmp = phdr->p_memsz / sizeof(Elf32_Dyn); - if (((Elf32_Dyn *) - params->dynamic_addr)[tmp - 1].d_tag != 0) + dyn = (Elf32_Dyn __user *)params->dynamic_addr; + __get_user(d_tag, &dyn[tmp - 1].d_tag); + if (d_tag != 0) goto dynamic_error; break; } |