]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
fs/binfmt_elf.c: fix ->start_code calculation
authorAlexey Dobriyan <adobriyan@gmail.com>
Fri, 31 Jan 2020 06:16:52 +0000 (22:16 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 31 Jan 2020 18:30:41 +0000 (10:30 -0800)
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 <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/binfmt_elf.c

index 7bb0deb5bf3b23238d06aefe97a033bcc07e10f1..59013f319f5411aaf59d38828bcb57a1bceeaa66 100644 (file)
@@ -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;