Commit 57511536 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'binfmt_elf-v5.17-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

Pull binfmt_elf fix from Kees Cook:
 "This addresses a regression[1] under ia64 where some ET_EXEC binaries
  were not loading"

Link: https://linux-regtracking.leemhuis.info/regzbot/regression/a3edd529-c42d-3b09-135c-7e98a15b150f@leemhuis.info/ [1]

- Fix ia64 ET_EXEC loading

* tag 'binfmt_elf-v5.17-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  binfmt_elf: Avoid total_mapping_size for ET_EXEC
parents 719fce75 439a8468
...@@ -1135,14 +1135,25 @@ static int load_elf_binary(struct linux_binprm *bprm) ...@@ -1135,14 +1135,25 @@ static int load_elf_binary(struct linux_binprm *bprm)
* is then page aligned. * is then page aligned.
*/ */
load_bias = ELF_PAGESTART(load_bias - vaddr); load_bias = ELF_PAGESTART(load_bias - vaddr);
}
/* /*
* Calculate the entire size of the ELF mapping (total_size). * Calculate the entire size of the ELF mapping
* (Note that load_addr_set is set to true later once the * (total_size), used for the initial mapping,
* initial mapping is performed.) * due to load_addr_set which is set to true later
*/ * once the initial mapping is performed.
if (!load_addr_set) { *
* Note that this is only sensible when the LOAD
* segments are contiguous (or overlapping). If
* used for LOADs that are far apart, this would
* cause the holes between LOADs to be mapped,
* running the risk of having the mapping fail,
* as it would be larger than the ELF file itself.
*
* As a result, only ET_DYN does this, since
* some ET_EXEC (e.g. ia64) may have large virtual
* memory holes between LOADs.
*
*/
total_size = total_mapping_size(elf_phdata, total_size = total_mapping_size(elf_phdata,
elf_ex->e_phnum); elf_ex->e_phnum);
if (!total_size) { if (!total_size) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment