* [PATCH] powerpc/kprobes: Fix handling of instruction emulation on probe re-entry
@ 2017-05-15 18:10 Naveen N. Rao
2017-05-17 9:34 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Naveen N. Rao @ 2017-05-15 18:10 UTC (permalink / raw)
To: Michael Ellerman
Cc: Ananth N Mavinakayanahalli, Masami Hiramatsu, linuxppc-dev
Commit 22d8b3dec214c ("powerpc/kprobes: Emulate instructions on kprobe
handler re-entry") enabled emulating instructions on kprobe re-entry,
rather than single-stepping always. However, we didn't update the single
stepping code to only be run if the emulation fails. Also, we missed
re-enabling preemption if the instruction emulation was successful. Fix
those issues.
Fixes: 22d8b3dec214c ("powerpc/kprobes: Emulate instructions on kprobe
handler re-entry")
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
Michael,
Sorry for letting this slip through. Between when I first wrote the
above commit to when I posted it, there was an issue with a rebase that
resulted in slightly different code getting through (in other words, I
messed up the rebase resolution). I have now tested this version and
verified that this works properly.
Thanks,
Naveen
arch/powerpc/kernel/kprobes.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 1ebeb8c482db..793c3385dfaa 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -299,16 +299,17 @@ int kprobe_handler(struct pt_regs *regs)
save_previous_kprobe(kcb);
set_current_kprobe(p, regs, kcb);
kprobes_inc_nmissed_count(p);
- prepare_singlestep(p, regs);
kcb->kprobe_status = KPROBE_REENTER;
if (p->ainsn.boostable >= 0) {
ret = try_to_emulate(p, regs);
if (ret > 0) {
restore_previous_kprobe(kcb);
+ preempt_enable_no_resched();
return 1;
}
}
+ prepare_singlestep(p, regs);
return 1;
} else {
if (*addr != BREAKPOINT_INSTRUCTION) {
--
2.12.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: powerpc/kprobes: Fix handling of instruction emulation on probe re-entry
2017-05-15 18:10 [PATCH] powerpc/kprobes: Fix handling of instruction emulation on probe re-entry Naveen N. Rao
@ 2017-05-17 9:34 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2017-05-17 9:34 UTC (permalink / raw)
To: Naveen N. Rao; +Cc: linuxppc-dev, Masami Hiramatsu
On Mon, 2017-05-15 at 18:10:05 UTC, "Naveen N. Rao" wrote:
> Commit 22d8b3dec214c ("powerpc/kprobes: Emulate instructions on kprobe
> handler re-entry") enabled emulating instructions on kprobe re-entry,
> rather than single-stepping always. However, we didn't update the single
> stepping code to only be run if the emulation fails. Also, we missed
> re-enabling preemption if the instruction emulation was successful. Fix
> those issues.
>
> Fixes: 22d8b3dec214c ("powerpc/kprobes: Emulate instructions on kprobe
> handler re-entry")
>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/d04c02f8aa96d82e4cbe783f85a820
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-17 9:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-15 18:10 [PATCH] powerpc/kprobes: Fix handling of instruction emulation on probe re-entry Naveen N. Rao
2017-05-17 9:34 ` Michael Ellerman
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.