On Fri, 6 Dec 2002, Jim Houston wrote:
>
> I know it would be a few extra lines of assembly code but it would be
> nice if the restart routine had the original arguments.
It's not even extra code on x86, since we don't stomp on any of the
arguments, and they will all have the same values when returning. So on
x86, we could see the arguments by just adding parameters to the
sys_restart_syscall() function.
However, the same is not necessarily true on other architectures, where
there can be overlap between clobbers and arguments (so that the first
invocation of the system call may have trashed the arguments unless it
explicitly saves it), and that's the reason I don't want to expose the
original ones.
Also, I actually much prefer the arguments to be saved away in the restart
block for another reason too - because that way you can _trust_ them. The
restart function basically knows that the arguments are truly the same
that were saved away - if you allow the register contents from user space
to be re-used, clever 'ptrace()' usage will be able to change the
registers.
In other words, with the current setup, we can actually have hidden kernel
state inside the restart block, and it never gets leaked to/from user
space. That's potentially quite useful in itself (you can cache argument
values).
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sat Dec 07 2002 - 22:00:28 EST