Re: [PATCH 2/2] [POWERPC] uprobes: powerpc port
flat view
From: Ananth N Mavinakayanahalli <hidden>
Date: 2012-06-12 04:52:59
Also in:
lkml
On Tue, Jun 12, 2012 at 02:01:46PM +1000, Michael Ellerman wrote:
On Fri, 2012-06-08 at 14:51 +0530, Ananth N Mavinakayanahalli wrote:quoted
On Fri, Jun 08, 2012 at 04:38:17PM +1000, Michael Ellerman wrote:quoted
On Fri, 2012-06-08 at 11:49 +0530, Ananth N Mavinakayanahalli wrote:quoted
On Fri, Jun 08, 2012 at 04:17:44PM +1000, Michael Ellerman wrote:quoted
On Fri, 2012-06-08 at 11:31 +0530, Ananth N Mavinakayanahalli wrote:quoted
On Fri, Jun 08, 2012 at 03:51:54PM +1000, Michael Ellerman wrote:quoted
On Fri, 2012-06-08 at 10:06 +0530, Ananth N Mavinakayanahalli wrote:But MSR_PR=1 and hence emulate_step() will return -1 and hence we will end up single-stepping using user_enable_single_step(). Same with rfid.Right. But that was exactly Jim's point, you may be asked to emulate those instructions even though you wouldn't expect to see them in userspace code, so you need to handle it. Luckily it looks like emulate_step() will do the right thing for you. It'd be good to test it to make 100% sure.Sure. Will add that check and send v2.Sorry I didn't mean add a test in the code, I meant construct a test case to confirm that it works as expected.Michael, I just hand-coded the instr to emulate_step() and here are the results: MSR_PR is set insn = 7c600124, ret = 0 /* mtmsr */ insn = 7c600164, ret = 0 /* mtmsrd */ insn = 4c000024, ret = -1 /* rfid */ insn = 4c000064, ret = 0 /* rfi */ Also verified that standalone programs with those instructions in inline asm will die with a SIGILL. So, for mtmsr, mtmsrd and rfi, we have to single-step them which will result in a SIGILL in turn.What happens in the rfid case? You don't handle -1 from emulate_step() any differently AFAICS, so don't we try to single step that too?
-1 is just emulate_step() flagging cases where instructions must not be single-stepped (rfi[d], mtmsr that clears MSR_RI). But as with the other OEA instructions in user space, we fail with a SIGILL. As the application is hozed in any case if we encounter an OEA instruction, I'd think there is no point in handling a -1 from emulate_step() any differently. Ananth