Bad code path in DoSyscall

Matt Porter mporter at
Tue Nov 11 03:46:24 EST 2003

On Mon, Nov 10, 2003 at 10:56:08AM -0500, John Whitney wrote:
> There seems to be a bad code path in the assembly routine DoSyscall()
> (arch/ppc/kernel/entry.S).  In the case of an invalid syscall being made (in
> my case, from user space), DoSyscall is called and eventually branches to
> label 66.  Note that before the branch, r12 is set to zero.


>     /* disable interrupts so current_thread_info()->flags can't change */
> 30: LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */
>     SYNC
>     MTMSRD(r10)
>     lwz r9,TI_FLAGS(r12)
> Which immediately causes a bad page fault kernel oops.  I haven't come up
> with a patch yet, but will try to when I get the time unless someone with
> more knowledge in this area wants to do it.  Just wanted to let the list
> know about the problem.

Thanks, here's a patch to grab the thread info when you go down the
no syscall path. This should cure the problem.

It's against linuxppc-2.5.  I think that's what you meant since this
bug isn't in 2.4.


===== arch/ppc/kernel/entry.S 1.40 vs edited =====
--- 1.40/arch/ppc/kernel/entry.S        Sat Sep 27 03:58:48 2003
+++ edited/arch/ppc/kernel/entry.S      Mon Nov 10 09:36:55 2003
@@ -234,6 +234,7 @@

 66:    li      r3,ENOSYS
+       rlwinm  r12,r1,0,0,18   /* current_thread_info() */
        b       22b

        .globl  ret_from_fork

** Sent via the linuxppc-dev mail list. See

More information about the Linuxppc-dev mailing list