mirror of
https://github.com/brain-hackers/linux-brain.git
synced 2024-06-09 23:36:23 +09:00
fs, elf: make sure to page align bss in load_elf_library
commit 24962af7e1
upstream.
The current code does not make sure to page align bss before calling
vm_brk(), and this can lead to a VM_BUG_ON() in __mm_populate() due to
the requested lenght not being correctly aligned.
Let us make sure to align it properly.
Kees: only applicable to CONFIG_USELIB kernels: 32-bit and configured
for libc5.
Link: http://lkml.kernel.org/r/20180705145539.9627-1-osalvador@techadventures.net
Signed-off-by: Oscar Salvador <osalvador@suse.de>
Reported-by: syzbot+5dcb560fe12aa5091c06@syzkaller.appspotmail.com
Tested-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
2c69d1f0db
commit
a0b71d1b89
|
@ -1214,9 +1214,8 @@ static int load_elf_library(struct file *file)
|
|||
goto out_free_ph;
|
||||
}
|
||||
|
||||
len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr +
|
||||
ELF_MIN_ALIGN - 1);
|
||||
bss = eppnt->p_memsz + eppnt->p_vaddr;
|
||||
len = ELF_PAGEALIGN(eppnt->p_filesz + eppnt->p_vaddr);
|
||||
bss = ELF_PAGEALIGN(eppnt->p_memsz + eppnt->p_vaddr);
|
||||
if (bss > len) {
|
||||
error = vm_brk(len, bss - len);
|
||||
if (BAD_ADDR(error))
|
||||
|
|
Loading…
Reference in New Issue
Block a user