mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Andres Salomon <dilinger@voxel.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel_read result fixes
Date: Wed, 29 Dec 2004 23:25:02 -0800	[thread overview]
Message-ID: <20041229232502.0549b408.akpm@osdl.org> (raw)
In-Reply-To: <1103873064.5994.6.camel@localhost>

Andres Salomon <dilinger@voxel.net> wrote:
>
> A few potential vulnerabilities were pointed out by Katrina Tsipenyuk in
>  <http://seclists.org/lists/linux-kernel/2004/Dec/1878.html>.  I haven't
>  seen any discussion or fixes of the issue yet, so here's a patch
>  (against 2.6.9).  The fixes are along the same lines as the previous
>  binfmt_elf fixes.  There's one additional place (inside fs/binfmt_som.c)
>  that a fix could be applied, but since that doesn't compile anyways, I
>  didn't see a point in patching it.

This patch is very wrong.

--- 25/fs/exec.c~kernel_read-result-fixes	2004-12-27 00:39:57.999820768 -0800
+++ 25-akpm/fs/exec.c	2004-12-27 00:39:58.007819552 -0800
@@ -1028,8 +1028,11 @@ int search_binary_handler(struct linux_b
 		bprm->file = file;
 		bprm->loader = loader;
 		retval = prepare_binprm(bprm);
-		if (retval<0)
+		if (retval != BINPRM_BUF_SIZE) {
+			if (retval >= 0)
+				retval = -EIO;
 			return retval;
+		}

prepare_binprm() can and will return values less than 128 if the
executable's file is less than 128 bytes in size.

	linux:/home/akpm> egrep
	zsh: Input/output error: egrep
	linux:/home/akpm> cat /bin/egrep
	#!/bin/sh
	exec /bin/grep -E ${1+"$@"}
	linux:/home/akpm> 

  parent reply	other threads:[~2004-12-30  7:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-24  7:24 Andres Salomon
2004-12-24 23:36 ` Andres Salomon
2004-12-30  7:25 ` Andrew Morton [this message]
2004-12-30  7:46   ` Andres Salomon

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=20041229232502.0549b408.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=dilinger@voxel.net \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome