From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: Fixing up unaligned userspace access
Date: Thu, 13 Mar 2008 10:39:29 +0000 [thread overview]
Message-ID: <20080313103929.GA6935@linux-sh.org> (raw)
In-Reply-To: <1204900215.12315.174.camel@atlas.mpc-data.co.uk>
On Wed, Mar 12, 2008 at 06:41:57PM +0000, Kieran Bingham wrote:
> On 07/03/2008, Adrian McMenamin <adrian@newgolddream.dyndns.info> wrote:
> > On Fri, March 7, 2008 2:30 pm, Kieran Bingham wrote:
> > >
> > > Fixing up unaligned userspace access in "sh" pidH pc=0x0ccda168
> > > ins=0x60f0
> > >
> > > Fixing up unaligned userspace access in "sh" pidH pc=0x0ccd9eac
> > > ins=0x9015
> > > Mainly I'm confused though, as looking at the assembly the instructions
> > > aren't unaligned ? and don't seem to be trying to do anything
> > > un-aligned ? - Is there something else that could be going on here?
>
> > My experience - admittedly with SH4 - is that these errors are almost
> > always caused by a memory leak, or access to uninitialized memory, elsewhere
> > in the kernel.
>
> The instructions don't look like they perform anything bad, because they don't!
>
> They are the wrong instructions. ... would seem that the address error
> trap handler is adding 4 to the regs pointer before it calls
> do_address_error, so regs->pc was actually returning the PR!!
>
> Does anyone know why this code adds 4 ?
> Can we remove it if its incorrect (patch below)
>
> I'm working on SH2a, so I don't know if its an SH2 specific thing
> thats been put in ?
>
It's definitely not an SH-2 thing. I wonder if it's a left over remnant
from when we were placing markers on the stack in the early days of the
SH-2 port. Anyways, dumping the stack from the address error path makes
it pretty obvious that the add is forcing all of the state to be off by
one register, which also explains why the regs->sr check was failing.
Given that, I'll add your patch to the 2.6.25 queue. Though it seems like
there are still a few corruption issues outstanding, which the slab
caches in particular seem to hit. There's occasional garbage in regs->pc,
which suggests that the exceptions are nesting and we're hitting the case
where the saved PC value is undefined. I've been debugging this most of
the day, and found a number of other bugs in the nommu code, but most of
the corruption issues are still outstanding (using current git both on
the SH7203 RSK and the SH7206 SolutionEngine).
next prev parent reply other threads:[~2008-03-13 10:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-07 14:30 Fixing up unaligned userspace access Kieran Bingham
2008-03-07 14:44 ` Adrian McMenamin
2008-03-12 18:41 ` Kieran Bingham
2008-03-13 10:39 ` Paul Mundt [this message]
2008-03-14 14:10 ` Kieran Bingham
2008-03-21 8:49 ` Paul Mundt
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=20080313103929.GA6935@linux-sh.org \
--to=lethal@linux-sh.org \
--cc=linux-sh@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.