From: Alexey Dobriyan Date: Fri, 31 Jan 2020 06:16:52 +0000 (-0800) Subject: fs/binfmt_elf.c: fix ->start_code calculation X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f67ef446291a09114f979a129fa42a859c5eb595;p=linux.git 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@avx2 Signed-off-by: Alexey Dobriyan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 7bb0deb5bf3b2..59013f319f541 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -999,7 +999,7 @@ out_free_interp: } } k = elf_ppnt->p_vaddr; - if (k < start_code) + if ((elf_ppnt->p_flags & PF_X) && k < start_code) start_code = k; if (start_data < k) start_data = k;