Re: [PATCH] introduce kernel_execve function to replace __KERNEL_SYSCALLS__

From: Paul Mackerras
Date: Sun Aug 20 2006 - 20:34:31 EST

Arnd Bergmann writes:

> Iit turned out most of the architectures that already implement
> their own execve() call instead of using the _syscall3 function
> for it end up passing the return value of sys_execve down,
> instead of setting errno.

I really don't like having an "errno" variable in the kernel. What if
two processes are doing an execve concurrently?

Anyway, your patch returns the (positive) errno value here:

> + WARN_ON(segment_eq(fs, USER_DS));
> + ret = execve(filename, (char **)argv, (char **)envp);
> + if (ret)
> + ret = errno;
> +
> + return ret;

but here we are testing for a negative value to mean error:

> - if (execve("/sbin/shutdown", argv, envp) < 0) {
> + if (kernel_execve("/sbin/shutdown", argv, envp) < 0) {

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at