times(2) sys call bug?

Joakim Tjernlund joakim.tjernlund at transmode.se
Fri Nov 21 03:49:01 EST 2008


On Thu, 2008-11-20 at 10:37 -0500, Josh Boyer wrote:
> On Thu, 20 Nov 2008 16:09:16 +0100
> "Joakim Tjernlund" <joakim.tjernlund at transmode.se> wrote:
> 
> > Why does the below program end up reporting -1
> > multiple seconds when times() wrap:
> 
> http://sources.redhat.com/bugzilla/show_bug.cgi?id=5209
> 
> josh

I see, but this is a new ppc kernel bug I think.
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.
Perhaps a known bug?

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 1cbbf70..72effde 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -278,7 +278,8 @@ ret_from_syscall:
        SYNC
        MTMSRD(r10)
        lwz     r9,TI_FLAGS(r12)
-       li      r8,-_LAST_ERRNO
+       //li    r8,-_LAST_ERRNO
+       li      r8,-2
        andi.   r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)
        bne-    syscall_exit_work
        cmplw   0,r3,r8




More information about the Linuxppc-dev mailing list