mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chris Rohlf" <chris.rohlf@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: binfmt_elf.c EI_CLASS check patch
Date: Mon, 26 Feb 2007 11:53:40 -0500	[thread overview]
Message-ID: <1681f2df0702260853u59ee7499nf2751034d5a2ec61@mail.gmail.com> (raw)

During some research of mine I realized most of my ELF analysis tools
break on ELF objects with an ELF header e_ident[EI_CLASS] not equal to
 ELFCLASS32 or ELFCLASS64. These objects still work fine because the
ELF  loader code does not check this value upon execution. So I wrote
a quick  patch to do it.

--- binfmt_elf.c.or1    2007-02-25 18:46:29.000000000 -0500
+++ binfmt_elf.c        2007-02-25 17:35:29.000000000 -0500
@@ -573,6 +573,10 @@ static int load_elf_binary(struct linux_
       if (!bprm->file->f_op||!bprm->file->f_op->mmap)
               goto out;

+        if (loc->elf_ex.e_ident[EI_CLASS] != ELFCLASS32 &&
+                loc->elf_ex.e_ident[EI_CLASS] != ELFCLASS64)
+                goto out;
+
       /* Now read in all of the header information */
       if (loc->elf_ex.e_phentsize != sizeof(struct elf_phdr))
               goto out;


I am not on the list, please CC replies to me.

Chris

-- 

http://em386.blogspot.com

                 reply	other threads:[~2007-02-26 16:53 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=1681f2df0702260853u59ee7499nf2751034d5a2ec61@mail.gmail.com \
    --to=chris.rohlf@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®