Message ID | 20170515181005.29517-1-naveen.n.rao@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | Accepted |
Commit | d04c02f8aa96d82e4cbe783f85a820aae820e746 |
Headers | show |
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
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) {
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(-)