public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Roy Lee" <roylee17@gmail.com>
To: <linux-kernel@vger.kernel.org>
Subject: [PATCH] give elf_check_arch() a chance for checking endian mismatch
Date: Thu, 20 Mar 2008 03:03:30 +0800	[thread overview]
Message-ID: <000101c889f3$ef5989e0$ce0c9da0$@com> (raw)

I'd like to warn for endianess mismatch, or unsupported feature( hardware
float point support) when loading an ELF file.
The problem is that if the endianess mismatches happens, the logic inside
the elf_check_arch() won't have a chance to be executed.
Because the "elf_ex.e_type" would be misinterpreted and the elf_check_arch()
will be skipped.
This patch should give elf_check_arch() more chance to do some machine
dependent checking.

Roy

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 672a3b9..2ffbe49 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -567,10 +567,10 @@ static int load_elf_binary(struct linux_binprm *bprm,
struct pt_regs *regs)
        if (memcmp(loc->elf_ex.e_ident, ELFMAG, SELFMAG) != 0)
                goto out;

-       if (loc->elf_ex.e_type != ET_EXEC && loc->elf_ex.e_type != ET_DYN)
-               goto out;
        if (!elf_check_arch(&loc->elf_ex))
                goto out;
+       if (loc->elf_ex.e_type != ET_EXEC && loc->elf_ex.e_type != ET_DYN)
+               goto out;
        if (!bprm->file->f_op||!bprm->file->f_op->mmap)
                goto out;



             reply	other threads:[~2008-03-19 19:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-19 19:03 Roy Lee [this message]
2008-03-23  5:06 ` [PATCH] give elf_check_arch() a chance for checking endian mismatch Valdis.Kletnieks
2008-03-23  9:41   ` Roy Lee

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='000101c889f3$ef5989e0$ce0c9da0$@com' \
    --to=roylee17@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