mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-01-01 14:52:14 +01:00
33 lines
1.1 KiB
Diff
33 lines
1.1 KiB
Diff
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
|
|
index 3aac8e9..4711413 100644
|
|
--- a/fs/binfmt_elf.c
|
|
+++ b/fs/binfmt_elf.c
|
|
@@ -804,21 +804,19 @@ static int load_elf_binary(struct linux_binprm *bprm)
|
|
* 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. */
|
|
+ if (elf_interpreter)
|
|
+ load_bias = 0x00400000UL;
|
|
+ else
|
|
+ load_bias = ELF_ET_DYN_BASE;
|
|
#ifdef CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE
|
|
/* Memory randomization might have been switched off
|
|
* in runtime via sysctl or explicit setting of
|
|
* personality flags.
|
|
- * If that is the case, retain the original non-zero
|
|
- * load_bias value in order to establish proper
|
|
- * non-randomized mappings.
|
|
*/
|
|
if (current->flags & PF_RANDOMIZE)
|
|
- load_bias = 0;
|
|
- else
|
|
- load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr);
|
|
-#else
|
|
- load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr);
|
|
+ load_bias = (get_random_int() & STACK_RND_MASK) << PAGE_SHIFT;
|
|
#endif
|
|
+ load_bias = ELF_PAGESTART(load_bias - vaddr);
|
|
}
|
|
|
|
error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt,
|