Re: [PATCH] introduce kernel_execve function to replace __KERNEL_SYSCALLS__

Arnd Bergmann
2006-08-20T19:31:57Z

On Sunday 20 August 2006 19:36, Chase Venters wrote:

> Unless there's some TLS kernel magic that I've totally missed, using errno in
> this manner is totally unsafe anyway. So I would NAK the above because your
> kernel_execve() function gives an unsafe errno value significance it should
> not have by turning it into a return value.

It has always resulted in an unsafe errno value, my patch just fixes it on
a few architectures and makes it safe there. Note that never even noticed
execve returning -1 on some architectures and -errno on others, and if
execve succeeds, errno is never assigned anyway.

> (As an aside, shouldn't that have read [ ret = -errno; ] anyway?)

Right, thanks for pointing this out.

> Unless 'errno' has some significant reason to live on in the kernel, I think
> it would be better to kill it and write kernel syscall macros that don't muck
> with it.

The direction in which this patch goes is to kill off kernel syscalls
entirely. The main problem there is that kernel_execve needs an architecture
specific implementation (calling sys_execve does the wrong thing), so doing
it all in one step would require knowing how to do it on all 20 architectures.
Once the execve kernel syscall is gone, errno can die with it.