LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jiri Kosina <jkosina@suse.cz>
To: Abel Bernabeu <abel.bernabeu@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Bug report in the elf loader
Date: Sun, 10 Feb 2008 22:15:26 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.0802102150070.30955@jikos.suse.cz> (raw)
In-Reply-To: <15577be70802081123w7df93c09l31d99a8140e7a28e@mail.gmail.com>

On Fri, 8 Feb 2008, Abel Bernabeu wrote:

> What is the official forum to report bugs in the kernel?

Hi Abel,

lkml is the most official forum you can find.

> I've making some testing of the elf loader in my host system (an x86
> PC with Linux version 2.6.18)... and I have finally found a bug.
> The elf loader does not always return the correct error code when
> trying to load incorrect binaries.
> The execution with 2 badly formed elf binaries leads to different error codes:
[ ... ]
> # ls ./bb386 ./bb386nc
> ./bb386  ./bb386nc  <------ Both files exist!!
> # ./execve ./bb386
> Executing ./bb386
> The result of exec is 2    <--------- Bad!!
> # ./execve ./bb386nc
> Executing ./bb386nc
> The result of exec is 8
> Execve should return 8 in both cases.
> I attach the two binaries so anyone familiar with the elf loader can
> try to figure out the problem... I can supply some details about how I
> produced the binaries if needed.

Well, bb386nc has its e_flags set to 0x2, which means that the binary is 
of type EF_BFIN_FDPIC.

The fdpic handler returns ENOENT if the PT_INTERP field of the binary is 
malformed, which is what you are probabling hitting here:

                        retval = -ENOENT;
                        if (interpreter_name[phdr->p_filesz - 1] != '\0')
                                goto error;

The 'standard' ELF binary handler returns ENOEXEC in such cases, and this 
is the difference you are seeing here.

I basically think that both errnos are allowed here:

ENOENT The file filename or a script or ELF interpreter does not exist, or 
a shared library needed for file or interpreter cannot be found.

ENOEXEC An executable is not in a recognized format, is for the wrong 
architecture, or has some other format error that means it cannot be 
executed.

-- 
Jiri Kosina
SUSE Labs

           reply	other threads:[~2008-02-10 21:15 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <15577be70802081123w7df93c09l31d99a8140e7a28e@mail.gmail.com>]

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=Pine.LNX.4.64.0802102150070.30955@jikos.suse.cz \
    --to=jkosina@suse.cz \
    --cc=abel.bernabeu@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: Bug report in the elf loader' \
    /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

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).