summaryrefslogtreecommitdiffstats
path: root/fs/binfmt_flat.c
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@snapgear.com>2006-01-10 16:59:37 +1000
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-10 09:31:27 -0800
commit845884d332c060b0dfc54ba5a580d0f1a99c58a2 (patch)
treeda786d4435001105f36d903b532a165e2bae5462 /fs/binfmt_flat.c
parent082f2c1cc7aa7aabdbf5235b788ff42e10abb399 (diff)
downloadop-kernel-dev-845884d332c060b0dfc54ba5a580d0f1a99c58a2.zip
op-kernel-dev-845884d332c060b0dfc54ba5a580d0f1a99c58a2.tar.gz
[PATCH] uclinux: delay binfmt_flat trace
Modify the initial trace output (which is based on flags in the binary header) so that it is not done until after the magic number check. This may well not be a flat format binary, so the flags could be invalid. (Prime example, running a script). Changes prompted by patches from Stuart Hughs. Signed-off-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/binfmt_flat.c')
-rw-r--r--fs/binfmt_flat.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index b72dc31..108d56bb 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -442,19 +442,22 @@ static int load_flat_file(struct linux_binprm * bprm,
flags = ntohl(hdr->flags);
rev = ntohl(hdr->rev);
- if (flags & FLAT_FLAG_KTRACE)
- printk("BINFMT_FLAT: Loading file: %s\n", bprm->filename);
-
- if (strncmp(hdr->magic, "bFLT", 4) ||
- (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION)) {
+ if (strncmp(hdr->magic, "bFLT", 4)) {
/*
* because a lot of people do not manage to produce good
* flat binaries, we leave this printk to help them realise
* the problem. We only print the error if its not a script file
*/
if (strncmp(hdr->magic, "#!", 2))
- printk("BINFMT_FLAT: bad magic/rev (0x%x, need 0x%x)\n",
- rev, (int) FLAT_VERSION);
+ printk("BINFMT_FLAT: bad header magic\n");
+ return -ENOEXEC;
+ }
+
+ if (flags & FLAT_FLAG_KTRACE)
+ printk("BINFMT_FLAT: Loading file: %s\n", bprm->filename);
+
+ if (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION) {
+ printk("BINFMT_FLAT: bad flat file version 0x%x (supported 0x%x and 0x%x)\n", rev, FLAT_VERSION, OLD_FLAT_VERSION);
return -ENOEXEC;
}
OpenPOWER on IntegriCloud