LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* binfmt_elf.c EI_CLASS check patch
@ 2007-02-26 16:53 Chris Rohlf
0 siblings, 0 replies; only message in thread
From: Chris Rohlf @ 2007-02-26 16:53 UTC (permalink / raw)
To: linux-kernel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-02-26 16:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-26 16:53 binfmt_elf.c EI_CLASS check patch Chris Rohlf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).