[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080512040122.GN13907@ZenIV.linux.org.uk>
Date: Mon, 12 May 2008 05:01:22 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: WANG Cong <xiyou.wangcong@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>, Andrew Morton <akpm@...l.org>,
WANG Cong <wangcong@...ux.org>
Subject: Re: [Patch 7/9] fs/exec.c: fix wrong return value of
prepare_binprm()
On Mon, May 12, 2008 at 11:56:43AM +0800, WANG Cong wrote:
> On Sat, May 10, 2008 at 08:31:05PM +0100, Al Viro wrote:
> >On Thu, May 08, 2008 at 09:52:32PM +0800, WANG Cong wrote:
> >> All prepare_binprm()'s callers assume that prepare_binprm() fails
> >> when it returns negative. However, prepare_binprm() most probably returns
> >> the return value of kernel_read(), which may return positive on failure!
> >>
> >> Thus this should be fixed.
> >
> >Since when does read return positive on failure?
>
> When an EIO occurs, I think. For example,
No. On EIO it returns -EIO, TYVM...
> retval = kernel_read(interpreter, interp_elf_ex->e_phoff,
> (char *)elf_phdata,size);
> error = -EIO;
> if (retval != size) {
> if (retval < 0)
> error = retval;
> goto out_close;
> }
Which is what we do on short read here. FWIW, -EINVAL might be saner
choice - it's "binary is corrupted", not "read had failed".
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists