ELF: fix ->start_code calculation
diff mbox series

Message ID 20191208171410.GB19716@avx2
State Accepted
Commit f67ef446291a09114f979a129fa42a859c5eb595
Headers show
Series
  • ELF: fix ->start_code calculation
Related show

Commit Message

Alexey Dobriyan Dec. 8, 2019, 5:14 p.m. UTC
Only executable segments should be accounted to ->start_code
just like they do to ->end_code (correctly).

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 fs/binfmt_elf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -997,7 +997,7 @@  static int load_elf_binary(struct linux_binprm *bprm)
 			}
 		}
 		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;