lkml.org 
[lkml]   [2008]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Patch 7/9] fs/exec.c: fix wrong return value of prepare_binprm()
On Mon, May 12, 2008 at 12:15:34PM +0800, WANG Cong wrote:
> And even if it is really "binary is corrupted", then -ENOEXEC is
> better than -EINVAL, isn't it?
>
> Anyway, kernel_read() may return postive when not success.

???

It returns positives *exactly* on success. In the case you've quoted
we don't have any problems with read; we do have a problem with _short_
read (i.e. miscalculated field size or truncated binary). In the case
you've patched we _expect_ a short read; it's normal for short scripts,
to start with. And we are ready to deal with it - the buffer is prefilled
with zeroes and either we have enough to recognize signature (in which case
we'll find the binfmt handler and let it deal with the entire thing, with
full checks of its own) or we will not, in which case nobody will recognize
the damn thing and that's it.


\
 
 \ /
  Last update: 2008-05-12 06:55    [W:0.066 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site