linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: Tiejun Chen <tiejun.chen@windriver.com>, linuxppc-dev@ozlabs.org
Subject: Re: [v3 PATCH 1/1] booke/kprobe: make program exception to use one dedicated exception stack
Date: Thu, 14 Jul 2011 10:53:52 -0500	[thread overview]
Message-ID: <20110714105352.452f9175@schlenkerla.am.freescale.net> (raw)
In-Reply-To: <CC4F4DC6-0682-4FC6-8D89-CE9AFEA7AD85@kernel.crashing.org>

On Thu, 14 Jul 2011 08:27:44 -0500
Kumar Gala <galak@kernel.crashing.org> wrote:

> 
> On Jul 11, 2011, at 6:31 AM, Tiejun Chen wrote:
> 
> > When kprobe these operations such as store-and-update-word for SP(r1),
> > 
> > stwu r1, -A(r1)
> > 
> > The program exception is triggered, and PPC always allocate an exception frame
> > as shown as the follows:
> > 
> > old r1 ----------
> >         ...
> >         nip
> >         gpr[2] ~ gpr[31]
> >         gpr[1] <--------- old r1 is stored.
> >         gpr[0]
> >       -------- <--------- pr_regs @offset 16 bytes
> >       padding
> >       STACK_FRAME_REGS_MARKER
> >       LR
> >       back chain
> > new r1 ----------
> > Then emulate_step() will emulate this instruction, 'stwu'. Actually its
> > equivalent to:
> > 1> Update pr_regs->gpr[1] = mem[old r1 + (-A)]
> > 2> stw [old r1], mem[old r1 + (-A)]
> > 
> > Please notice the stack based on new r1 may be covered with mem[old r1
> > +(-A)] when addr[old r1 + (-A)] < addr[old r1 + sizeof(an exception frame0].
> > So the above 2# operation will overwirte something to break this exception
> > frame then unexpected kernel problem will be issued.
> > 
> > So looks we have to implement independed interrupt stack for PPC program
> > exception when CONFIG_BOOKE is enabled. Here we can use
> > EXC_LEVEL_EXCEPTION_PROLOG to replace original NORMAL_EXCEPTION_PROLOG
> > for program exception if CONFIG_BOOKE. Then its always safe for kprobe
> > with independed exc stack from one pre-allocated and dedicated thread_info.
> > Actually this is just waht we did for critical/machine check exceptions
> > on PPC.
> > 
> > Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
> > ---
> 
> I'm still very confused why we need a unique stack frame for kprobe/program exceptions on book-e devices.

I don't know why it's booke-specific (or why they're emulating rather than
using single-step), but the problem is trying to emulate an instruction
that's expanding the non-exception stack into the area that the exception
handler is sitting on, and writing to that new stack area.

-Scott

  reply	other threads:[~2011-07-14 15:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-11 11:31 [v3 PATCH 1/1] booke/kprobe: make program exception to use one dedicated exception stack Tiejun Chen
2011-07-11 11:31 ` [v3] booke/kprobe: Fix stack corrupt issue when kprobe 'stwu' Tiejun Chen
2011-07-14 11:56   ` tiejun.chen
2011-07-12  2:35 ` [v3 PATCH 1/1] booke/kprobe: make program exception to use one dedicated exception stack tiejun.chen
2011-07-14 13:27 ` Kumar Gala
2011-07-14 15:53   ` Scott Wood [this message]
2011-07-15  5:28   ` tiejun.chen
2011-07-15 18:42     ` Scott Wood
2011-07-16  3:25       ` Chen, Tiejun
2011-07-18 15:56         ` Scott Wood
2011-07-19 10:52           ` tiejun.chen
2011-08-30  5:44             ` Benjamin Herrenschmidt
2011-08-31  9:17               ` tiejun.chen
2011-08-31 21:32                 ` Benjamin Herrenschmidt
2011-07-21  9:32     ` tiejun.chen

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=20110714105352.452f9175@schlenkerla.am.freescale.net \
    --to=scottwood@freescale.com \
    --cc=galak@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=tiejun.chen@windriver.com \
    /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).