Commit f67ef446 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds

fs/binfmt_elf.c: fix ->start_code calculation

Only executable segments should be accounted to ->start_code just like
they do to ->end_code (correctly).

Link: http://lkml.kernel.org/r/20191208171410.GB19716@avx2Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1f83d806
...@@ -999,7 +999,7 @@ static int load_elf_binary(struct linux_binprm *bprm) ...@@ -999,7 +999,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
} }
} }
k = elf_ppnt->p_vaddr; k = elf_ppnt->p_vaddr;
if (k < start_code) if ((elf_ppnt->p_flags & PF_X) && k < start_code)
start_code = k; start_code = k;
if (start_data < k) if (start_data < k)
start_data = k; start_data = k;
......
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