Re: times(2) sys call bug?
From: Joakim Tjernlund <hidden>
Date: 2008-11-21 10:13:10
On Fri, 2008-11-21 at 10:50 +0100, Gabriel Paubert wrote:
On Fri, Nov 21, 2008 at 08:03:06PM +1100, Paul Mackerras wrote:quoted
Gabriel Paubert writes:quoted
On Fri, Nov 21, 2008 at 10:52:14AM +1100, Paul Mackerras wrote:quoted
Joakim Tjernlund writes:quoted
This little hack changes the kernel sys call handling in an crude way and then it works. Apperently the kernel thinks is an error if the syscall returns a value between -_LAST_ERRNO and -1.Try this patch and let me if it fixes it. If it does I'll push it upstream.With your patch, you won't get EFAULT if you pass a bad address, but a constant, time independent value, unless I miss something.I think you are missing something, namely that I put the call to force_successful_syscall_return() AFTER the return -EFAULT.Indeed, it may be time to update the syscall documentation, saying that you need to clear errno before the syscall and check errno and not the return value since -1 is valid.
And perhaps mention that times(NULL) never returns an error. And that times() is broken in 2.6.27 and earlier and needs the workaround posted earlier. Jocke