diff options
| -rw-r--r-- | fs/binfmt_elf.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index dd0fdfc56d38..21ac5ee4b43f 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
| @@ -795,7 +795,16 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
| 795 | * might try to exec. This is because the brk will | 795 | * might try to exec. This is because the brk will |
| 796 | * follow the loader, and is not movable. */ | 796 | * follow the loader, and is not movable. */ |
| 797 | #if defined(CONFIG_X86) || defined(CONFIG_ARM) | 797 | #if defined(CONFIG_X86) || defined(CONFIG_ARM) |
| 798 | load_bias = 0; | 798 | /* Memory randomization might have been switched off |
| 799 | * in runtime via sysctl. | ||
| 800 | * If that is the case, retain the original non-zero | ||
| 801 | * load_bias value in order to establish proper | ||
| 802 | * non-randomized mappings. | ||
| 803 | */ | ||
| 804 | if (current->flags & PF_RANDOMIZE) | ||
| 805 | load_bias = 0; | ||
| 806 | else | ||
| 807 | load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr); | ||
| 799 | #else | 808 | #else |
| 800 | load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr); | 809 | load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr); |
| 801 | #endif | 810 | #endif |
