archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <>
Subject: [PATCH] ELF: fix ->start_code calculation
Date: Sun, 8 Dec 2019 20:14:10 +0300	[thread overview]
Message-ID: <20191208171410.GB19716@avx2> (raw)

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

Signed-off-by: Alexey Dobriyan <>

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

--- 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;

                 reply	other threads:[~2019-12-08 17:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191208171410.GB19716@avx2 \ \ \ \
    --subject='Re: [PATCH] ELF: fix ->start_code calculation' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox