Is it legal to return positive value when do_execve() succeeds?

From: Tetsuo Handa
Date: Thu Sep 30 2010 - 09:08:03 EST


Hello.

I was browsing do_execve() and noticed that do_execve() will return positive
return value if "struct linux_binfmt"->load_binary() returned positive return
value. So far, all in-tree "struct linux_binfmt" users seem to return 0 on
success and negative return value on failure. But search_binary_handler()
itself is designed to allow positive return value on successful execve().

--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1413,6 +1413,9 @@ int do_execve(const char * filename,
free_bprm(bprm);
if (displaced)
put_files_struct(displaced);
+ /* Just for testing. */
+ if (!retval)
+ retval = 1;
return retval;

out:

With a patch above (on x86 CentOS 5.5 with 2.6.36-rc6 kernel),
a few programs failed to work properly.

udevd-event[$PID]: run_program: '$PROGRAM' abnormal exit

Is it legal to return positive value when do_execve() succeeds?

Regards.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/