All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinz-Ado Arnolds <Ado.Arnolds@dhm-systems.de>
To: torvalds@transmeta.com, linux-kernel@vger.kernel.org,
	alan@lxorguk.ukuu.org.uk
Subject: fs/exec.c and binfmt-xxx in 2.4.14
Date: Wed, 21 Nov 2001 17:58:26 +0100	[thread overview]
Message-ID: <3BFBDD32.434AB47B@web-systems.net> (raw)

Hi Linus, Hi Alan, Hi all,

I have a problem with loading modules for binary formats. The
reason for this problem shows up in fs/exec.c search_binary_handler().

Starting with linux-2.1.23 (and up to 2.4.14) there was a change
in the format and offset of printing the magic number for requesting
a handler module. Up to 2.1.22 the statement

    sprintf(modname, "binfmt-%hd", *(unsigned short *)(&bprm->buf[0]));
                              ^^                                 ^^^

was used. Now, and up to 2.4.14, the statement is:

    sprintf(modname, "binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
                              ^^^                                 ^^^

This leads to a request for loading a module which doesn't exist.
Additionally the request is now done with a hex number but modprobe
expects decimal numbers.

>From modutils-2.4.12/util/alias.h:

    ...
    "binfmt-267 binfmt_aout",
    ...
    "binfmt-332 iBCS",
    ...

When i now try to start an older binary in a.out format, which has a
magic number of 0x010b0064, it is translated with the 'new' code to a
request for "binfmt-0064" instead of "binfmt-267" as expected and
properly handled by modprobe.

Another example: for an old COFF executable with magic number
0x014c0004 the generated request is "binfmt-0004" instead of the
correct value "binfmt-332".

Wouldn't it be appropriate to revert the changes to format "%hd"
and use buffer offset 0 again?

Thanks a lot for your help and many greetings from Cologne, Germany

Ado

-- 
------------------------------------------------------------------------
  Heinz-Ado Arnolds                        Ado.Arnolds@web-systems.net
  Websystems GmbH                              +49 2234 1840-0 (voice)
  Max-Planck-Strasse 2, 50858 Koeln, Germany   +49 2234 1840-40  (fax)

             reply	other threads:[~2001-11-21 16:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-21 16:58 Heinz-Ado Arnolds [this message]
2001-11-21 17:08 ` fs/exec.c and binfmt-xxx in 2.4.14 Martin Dalecki
2001-11-21 17:31   ` Heinz-Ado Arnolds
2001-11-22 13:21   ` Colin Watson
2001-11-21 20:14 ` Andreas Ferber
2001-11-22 11:47   ` Heinz-Ado Arnolds
2001-11-22 12:43     ` Richard Guenther
2001-11-22 13:31     ` Andreas Schwab

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=3BFBDD32.434AB47B@web-systems.net \
    --to=ado.arnolds@dhm-systems.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.