[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <000101c889f3$ef5989e0$ce0c9da0$@com>
Date: Thu, 20 Mar 2008 03:03:30 +0800
From: "Roy Lee" <roylee17@...il.com>
To: <linux-kernel@...r.kernel.org>
Subject: [PATCH] give elf_check_arch() a chance for checking endian mismatch
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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists