linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Matt Porter <mporter@kernel.crashing.org>
To: John Whitney <john.whitney@timesys.com>
Cc: "Mailing List: linuxppc-dev" <linuxppc-dev@lists.linuxppc.org>
Subject: Re: Bad code path in DoSyscall
Date: Mon, 10 Nov 2003 09:46:24 -0700	[thread overview]
Message-ID: <20031110094624.A29465@home.com> (raw)
In-Reply-To: <BBD51F48.2329%john.whitney@timesys.com>; from john.whitney@timesys.com on Mon, Nov 10, 2003 at 10:56:08AM -0500


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.

<snip>

>     /* 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.

-Matt

===== 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 @@
        RFI

 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 http://lists.linuxppc.org/

  reply	other threads:[~2003-11-10 16:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-10 15:56 Bad code path in DoSyscall John Whitney
2003-11-10 16:46 ` Matt Porter [this message]
2003-11-11  0:14 ` Paul Mackerras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031110094624.A29465@home.com \
    --to=mporter@kernel.crashing.org \
    --cc=john.whitney@timesys.com \
    --cc=linuxppc-dev@lists.linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).